I have a solution that consists of both single-target and multi-target projects. The solution can be built in Visual Studio 2017 and Developer Command Prompt for VS 2017 without problems.
I build the solution by below code in Developer Command Prompt for VS 2017
msbuild MySolution.sln /t:Rebuild /p:Configuration=Release
I want to do this process in Jenkins. Then I added below command to Jenkins.
pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools"
call VsDevCmd.bat
msbuild "C:\Workspace\My Solution\MySolution.sln" /t:Build /p:Configuration=Release
When I build the Jenkins project it throws an exception.
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\
Microsoft.PackageDependencyResolution.targets(327,5): error : Assets file
'C:\Workspace\My Solution\Source\MyProject\obj\project.assets.json' not found.
Run a NuGet package restore to generate this file.
Thanks a lot