Open tompazourek opened 6 years ago
@tompazourek Doesn't sound like a Cake issue, but hard to know without the actual build script. Can you run the build with diagnostic verbosity and paste the build log here? Thanks.
@patriksvensson Thanks for getting back to me. Unfortunately, I'm afraid I cannot assist more at this point because I decided to uninstall Visual Studio 15.6.3 and revert back to an older version again. I really needed to get some work done, and this was the only solution.
Maybe somebody else will experience the same issue and will follow up with more information; the 15.6.3 is a brand new release, and it's possible that more people will have the same issue when they update. Or I may try updating to 15.6.3 again when I've got a bit more time to experiment to pinpoint this issue.
In the meantime, there's some more development related to this in the mentioned Visual Studio Developer Community ticket. Right now, it looks like it might be solved by removing some MSBuild assemblies from the GAC.
@patriksvensson It looks like a conflict between Cake tool selection and how VS was installed
I was getting similar issue with Cake 0.30 and VS 15.8.3 with a csproj, which has a custom task from dll. The said task references Microsoft.Build.Framework. Running raw MSBuild with sln = no issues Running cake with 1-liner task results in an error:
Task("Default")
.Does(() =>
{
MSBuild("./s.sln");
});
Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
It's similar to this: https://stackoverflow.com/questions/43330915/could-not-load-file-or-assembly-microsoft-build-frameworkvs-2017
If I add Microsoft.Build.Framework to GAC, it works fine, but it's something I'd like to avoid, especially as raw MSBuild worked just fine.
When I add this line to csproj:
<Message Text="MSBuildBinPath = $(MSBuildBinPath)"/>
with raw MSBuild it shows:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin
with Cake:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64
If I add C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64 in the beginning of my PATH environment variable, I'm getting exactly the same issue with msbuild as with Cake
Using such settings modifier fixes this issue in my case:
settings.SetMSBuildPlatform(MSBuildPlatform.x86)
Before using Cake, I used this PS snippet to get MSBuild path (yes, always x86)
Join-Path (&'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.Component.MSBuild -property installationPath) 'Bin\MSBuild.exe'
This in fact may be related to (and solved by) this (+ the mentioned GAC issue): https://github.com/cake-build/cake/issues/424
VSWHere can be used with cake too https://cakebuild.net/blog/2017/03/vswhere-and-visual-studio-2017-support
I just updated to latest version of Visual Studio 2017 (15.6.3) that was just released and my Cake builds started crashing (when restoring NuGet packages or running the build task).
This is the snippet of the log:
I'm using Cake 0.26.1 and building on Windows 10, it's a full .NET Framework 4.7.1 app, old csproj structure.
I get the error from running
NuGetRestore(solutionFile)
, but also from runningMSBuild(solutionFile, ...)
.Is this a Cake issue, or should I look for help somewhere else? Can you help?
Thanks for your time.
EDIT: The only other mention of this error I Googled is:
https://developercommunity.visualstudio.com/content/problem/214894/vs-2017-update-v1561-v1562-msbuild-crashes.html