Building a Visual Studio 2015 Solution Using MSBuild 12

I am trying to build a solution on Jenkins with the MSBuild extension. I migrated the solution from VS 2013 to VS 2015. In order to be able to restore NuGet packages in Visual Studio 2015, I had to delete the .nuget folder, as recommended here: http://docs.nuget.org/consume/package-restore/migrating- to-automatic-package-restore .

Now the problem is that MSBuild needs a .nuget folder to restore nuget packages.

Build FAILED. "E:\_JENKINS\workspace\Project1 - Deploy DEVELOP to BuildServer\Solution1\Build\Build.proj" (DeployTarget target) (1) -> E:\_JENKINS\workspace\Project1 - Deploy DEVELOP to BuildServer\Solution1\Build\Build.proj(50,5): error MSB4019: The imported project "E:\_JENKINS\workspace\Project1 - Deploy DEVELOP to BuildServer\Solution1\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. 0 Warning(s) 1 Error(s) 

Am I mixed up something? Am I doing something completely wrong?
Because only one works: restoring MSBuild or Studio Package.

So, either I add the package folder to git, or replace the automatic recovery in the solution using command line or MSBuild recovery. But in any case, both solutions seem to be wrong.

+4
source share
1 answer

A way to replace the NuGet Package Restore between Visual Studio 2013 and 2015.

The first step in your build process should be a direct call to NuGet.exe, for example:

 nuget restore solution.sln 

I put NuGet.exe in PATH on my build machine.

You should see the packets being restored in the console (or in the pipeline protocol protocol).

If not, you may need to look at the Jenkins proxy settings, depending on where your Jenkins is located on the network with respect to the Internet. I used to have to request a service account with privileged access to nuget.org/*

After restoring all the packages, you should see the package / folder as sibling to the solution file in the Jenkins workspace.

You can then invoke MSBuild with / t: Clean and / t: rebuild in turn and expect to go through the NuGet step.

0
source

All Articles