When running nuget update 'some.solution.sln' -id 'Some.Package.Id'
yesterday, I got the following error:
Scanning for projects...
MSBuild auto-detection: using msbuild version '15.4.8.50001' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\
Enterprise\MSBuild\15.0\bin'.
The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Roslyn\
Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct,
and that the file exists on disk. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\
Microsoft.CSharp.CurrentVersion.targets
Eventually I saw that the auto-detected version of MSBuild was withinin an Enterprise
Visual Studio directory. I do not have an Enterprise version of Visual Studio installed, so I tried running this command instead:
nuget update 'some.solution.sln' -id 'Some.Package.Id' -MSBuildPath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64'
Notice that the path above has 'Professional' in it, instead of 'Enterprise'. (Also note that passing a fully qualified path to msbuild.exe won't work.) This time, the command succeeded! But since I didn't want to pass that path to nuget every time I called it, I just deleted the Enterprise copy of msbuild.exe and auto-detection just used the file contained in the 'Professional' directory instead.
THANK YOU! 👍