question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restore-NuGet-Packages always looking for 'Microsoft.Build, Version=14.0.0.0'

See original GitHub issue

Cake is always looking for MSBuild 14.0.0 when I do restore my Nuget-Packages. How can I change It to use MSBuildToolVersion.VS2013?

What You Are Seeing?

Error when the Restore Nuget Package block runs. When I take out this step from the code Build runs.

What is Expected?

I expect that the Restore step works.

What version of Cake are you using?

0.17.0

Are you running on a 32 or 64 bit system?

64 bit

What environment are you running on? Windows? Linux? Mac?

Windows 7

Are you running on a CI Server? If so, which one?

No

How Did You Get This To Happen? (Steps to Reproduce)

build.ps1

Output Log

========================================
Restore-NuGet-Packages
========================================
Executing task: Restore-NuGet-Packages
Failed to load msbuild Toolset
  Não foi possível carregar arquivo ou assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f
5f7f11d50a3a' ou uma de suas dependências. O sistema não pode encontrar o arquivo especificado.
An error occurred when executing task 'Restore-NuGet-Packages'.
Error: NuGet: Process returned an error (exit code 1).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
falscommented, Jan 12, 2017

@patriksvensson and @devlead I’m trying to change the NuGet.exe, I have it at the root of the solution, because I enabled NuGet package restore, but It’s not working. Which parametter I should set?

NuGetRestore("./SIGOP.sln", new NuGetRestoreSettings { 
        MSBuildVersion = NuGetMSBuildVersion.MSBuild12,
        ToolPath = "./.nuget/NuGet.exe"
    });

Same output as error, still trying MsBuild 14:

========================================
Restore-NuGet-Packages
========================================
Executing task: Restore-NuGet-Packages
Executing: "D:/Repository/SEST_SENAT/src/Development/Api/.nuget/NuGet.exe" restore "D:/Repository/SEST_SENAT/src/Develop
ment/Api/SIGOP.sln" -MSBuildVersion 12 -NonInteractive
Failed to load msbuild Toolset
  Não foi possível carregar arquivo ou assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f
5f7f11d50a3a' ou uma de suas dependências. O sistema não pode encontrar o arquivo especificado.
An error occurred when executing task 'Restore-NuGet-Packages'.
Error: Cake.Core.CakeException: NuGet: Process returned an error (exit code 1).
   em Cake.Core.Tooling.Tool`1.ProcessExitCode(Int32 exitCode)
   em Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings
, Action`1 postAction)
   em Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments)
   em Cake.Common.Tools.NuGet.Restore.NuGetRestorer.Restore(FilePath targetFilePath, NuGetRestoreSettings settings)
   em Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore(ICakeContext context, FilePath targetFilePath, NuGetRestoreSetti
ngs settings)
   em Submission#0.<.ctor>b__2()
   em Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass5_0.<Does>b__0(ICakeContext context)
   em Cake.Core.ActionTask.Execute(ICakeContext context)
   em Cake.Core.DefaultExecutionStrategy.Execute(CakeTask task, ICakeContext context)
   em Cake.Core.CakeEngine.ExecuteTask(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask
task, CakeReport report)
   em Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, String target)
   em Cake.Scripting.BuildScriptHost.RunTarget(String target)
   em Submission#0..ctor(Session session, Object& submissionResult)
   em Submission#0.<Factory>(Session session)
   em Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session sessio
n, Boolean isInteractive)
   em Roslyn.Scripting.Session.Execute(String code)
   em Cake.Scripting.Roslyn.Stable.DefaultRoslynScriptSession.Execute(Script script)
   em Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
   em Cake.Commands.BuildCommand.Execute(CakeOptions options)
   em Cake.CakeApplication.Run(CakeOptions options)
   em Cake.Program.Main()
1reaction
devleadcommented, Jan 12, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cake NuGetRestore always wants MSBuild14?
What you could try is to use the MSBuild alias with the restore target, latest version of MSBuild should have build in NuGet...
Read more >
Troubleshooting NuGet Package Restore in Visual Studio
Package Restore tries to install all package dependencies to the correct state matching the package references in your project file (.csproj) or ...
Read more >
NuGet Package Restore
See an overview of how NuGet restores packages a project depends on, including how to disable restore and constrain versions.
Read more >
restore command (NuGet CLI)
The restore command performs the following steps: Determine the operation mode of the restore command. ... Determine the packages folder using the ...
Read more >
Nuget restore - system cannot find file - Microsoft.Build. ...
Everytime I try to run Nuget restore I get this error. I get on another server that I am trying to put a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found