Nuget package restore issue in two different version

3.7k views Asked by At

nuget restore working properly in nuget.exe version 3.4.4.132 but in 3.5 returns below error code

Failed to load msbuild Toolset
  Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
or one of its dependencies. The system cannot find the file specified.
An error occurred when executing task 'NugetRestore'.
Error: NuGet: Process returned an error (exit code 1).

Please help me on this issue.

1

There are 1 answers

2
Ranadip Dutta On

This seems to be due to the msbuild.exe in your path is version 3.5. MSBuild 3.5 does not have two .dll's that we are attempting to load dynamically ("Microsoft.Build.dll and Microsoft.Build.Framework.dll")

Please make sure NuGet.exe uses MSBuild 4.0 or higher. This can be done by making sure MSBuild 4.0 or higher is the first to resolve in your path or by passing the -msbuildversion option.

Check the following commands:

MSBuild.exe /version

Get-Command MSBuild.exe

Hope it helps.