Search code examples
msbuildazure-devopsazure-data-lakeu-sql

The target “Build” does not exist in the project working with Continuous integration with MSbuild for U-SQL


I am working with continous integration with vsts using MSBuild for U-SQL reffering the link : https://blogs.msdn.microsoft.com/azuredatalake/2017/10/24/continuous-integration-made-easy-with-msbuild-support-for-u-sql-preview/

But i am facing below issue while working with VSTS Build server

ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". ADLAUSQL1\ADLAUSQL1.usqlproj(0,0): Error MSB4057: The target "Build" does not exist in the project. Project "D:\a\1\s\ADLAUSQL1.sln" (1) is building "D:\a\1\s\ADLAUSQL1\ADLAUSQL1.usqlproj" (2) on node 1 (default targets). D:\a\1\s\ADLAUSQL1\ADLAUSQL1.usqlproj : error MSB4057: The target "Build" does not exist in the project. Done Building Project "D:\a\1\s\ADLAUSQL1\ADLAUSQL1.usqlproj" (default targets) -- FAILED. Done Building Project "D:\a\1\s\ADLAUSQL1.sln" (default targets) -- FAILED. Build FAILED. "D:\a\1\s\ADLAUSQL1.sln" (default target) (1) -> "D:\a\1\s\ADLAUSQL1\ADLAUSQL1.usqlproj" (default target) (2) -> D:\a\1\s\ADLAUSQL1\ADLAUSQL1.usqlproj : error MSB4057: The target "Build" does not exist in the project. 0 Warning(s) 1 Error(s)

My build arguments is - /p:USQLSDKPath=$(Build.SourcesDirectory)/USQLMSBuild/packages/Microsoft.Azure.DataLake.USQL.SDK.1.3.180223/build/runtime /p:USQLTargetType=SyntaxCheck /p:DataRoot=$(Build.SourcesDirectory)

Any help will be much appreciated. Pls let me know if you need any further information.


Solution

  • To troubleshoot this issue, please check the following aspects:

    1. The usql project can build with msbuild successful First, you should make sure your project can build successful in your local machine. Then build in VSTS.

    2. Check the MSBuild arguments

      Assume the project structure in your repo as below:

      root repo
          |___ADLAUSQL1.sln
          |___ADLAUSQL1
                 |___ADLAUSQL1.usqlproj
                 |___...
      

      Then you should specify the USQLSDKPath as $(Build.SourcesDirectory)/ADLAUSQL1/packages/Microsoft.Azure.DataLake.USQL.SDK.1.3.180223/build/runtime.

      Note: the Microsoft.Azure.DataLake.USQL.SDK.1.3.180223 means you install the version 1.3.180223 of the package Microsoft.Azure.DataLake.USQL.SDK in your project.

    3. Choose the VS version for the project correctly

      And make sure you used the right VS version to build. Since you are using hosted agent, please select Hosted agent or Hosted VS2017 agent based on your requirement:

      • If you want to build your project with VS2015, you should select Hosted agent.
      • If you want to build your project with VS2017, you should use Hosted VS2017 agent instead.

    enter image description here