0
votes

I have .net solution having multiple .net core project and setup CI on VSTS. everything running perfectly when I had all project targeting to .net core 2.0 only.

My build getting fails after adding Azure WebJob project. Anyone know how to resolve this issue?? I don't want to manage different solution for full .net and .net core. Below my CI build definition.

enter image description here

enter image description here

Below error I'm getting...

2017-10-22T05:44:01.5211719Z [command]d:\a_tool\dncs\2.0.0\x64\dotnet.exe build d:\a\1\s\TestHub.WebJob.OTP\TestHub.WebJob.OTP.csproj --configuration release 2017-10-22T05:44:01.8667544Z d:\a\1\s\packages\Microsoft.Web.WebJobs.Publish.1.1.0\tools\webjobs.console.targets(24,3): error MSB4019: The imported project "d:\a_tool\dncs\2.0.0\x64\sdk\2.0.0\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. [d:\a\1\s\TestHub.WebJob.OTP\TestHub.WebJob.OTP.csproj] 2017-10-22T05:44:01.8978067Z ##[error]Error: d:\a_tool\dncs\2.0.0\x64\dotnet.exe failed with return code: 1

Thanks in Advance

2
What is failing? What error messages are you getting? You need to provide relevant diagnostic information if you want people to be able to help you.Daniel Mann
Which VS version did you used for the build and how did you add Azure WebJob project if you are using VS2017? And can you show the detail build logs by setting system.debug as true in VSTS build definition Variables Tab?Marina Liu
@DanielMann update error logs.Pankaj Rawat
@Marina-MSFT I'm using VS2017. If you will see my build definition I'm trying to build all project using .NET Core (full .net + .net core project under single solution) that is why I'm getting an error. Is there any way to tell VSTS not build all project using .net core Build??Pankaj Rawat
To build only for the .net core projects, you just need to specify the path for .net core projects, then the .Net Core build task will build the projects you specified. And can you show the whole build logs (including all the tasks build information)? And what's the TestHub.WebJob.OTP.csproj project, is it a .net project?Marina Liu

2 Answers

3
votes

Only to build .net projects in .NET Core build task, you just need to specify the .net core projects instead of using **/*.csproj. Assume the projects structure as below:

TestHub.WebJob.OTP
         |___ TestHub.WebJob.OTP.csproj
         |___ dotnetCoreproject1
                      |___ dotnetCoreproject1.csproj
                      |___ …
         |___ dotnetCoreProject2
                      |___ dotnetProject2.csproj
                      |___ …
         |___ …

And only dotnetProject1.csproj and dotnetProject2.csproj are .net core projects. So in .NET Core build task, you should change Path to project(s) option with two lines as below:

TestHub.WebJob.OTP/dotnetCoreproject1/dotnetCoreproject1.csproj
TestHub.WebJob.OTP/dotnetCoreproject2/dotnetCoreproject2.csproj

enter image description here

0
votes

Using Visual Studio Build task instead, task:

  1. NuGet Tool Installer (4.3.0)
  2. NuGet Restore
  3. Visual Studio Build (MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)")

Note: You can still run test through .Net Core Test task.