Cake: Not able to build project with ToolsVersion="15.0"

Created on 3 Apr 2019  路  9Comments  路  Source: cake-build/cake

After the update of the dotnet framework sdk image my CI pipeline is no longer working.
Seams that the current cake version (0.33.0) still have the preview path for the msbuild:

'/Program86/Microsoft Visual Studio/2019/Preview/MSBuild/Current/Bin/MSBuild.exe'

https://github.com/Microsoft/dotnet-framework-docker/issues/256

Thanks
G.

Feature

Most helpful comment

Is it possible to add fix for this earlier than 0.34 milestone is completed? e.g. to fix default toolpath with 0.33.1 for example?

All 9 comments

@giusepanzuto thanks for raising this issue. Looks like we might need to do a quick release to add 2019 support, now that it has been officially released.

@giusepanzuto actually, can you provide a set of steps to reproduce the problem, so that we can test to see if things are resolved after changes?

Please have a look at cake/src/Cake.Common/Tools/MSBuild/MSBuildResolver.cs
in function "GetHighestAvailableMSBuildVersion" is still an comment, which disables MSBuild16:

var versions = new[]
{
// MSBuildVersion.MSBuild16, /Since it's still in preview, do not search unless specified. Uncomment after stable version released/
MSBuildVersion.MSBuild15,
MSBuildVersion.MSBuild14,

@wuerzi2000 yes, I am aware of the code. That still doesn鈥檛 change the request for a valid test case to ensure everything is working as expected, before and after a change.

If you have VS2019 installed, you can use the following small sample project and just run the Build task.
CakeVS2019Test.zip

I can confirm that the change fixes the issue. I created a PR for it.

@Roemer i tested your sample with 2019 too. A little drawback for a testdriver is, that you only get an output that there is an automatic downgrade from ToolsVersion="15.0" to ToolsVersion="4.0" if msbuild16 was not found. I have no idea to check is it is realy msbuild16!

I little workaround is to use newer C# 7/8 language keywords, so you get a real exception. For example string interpolation:
Console.WriteLine($"Hello Today {DateTime.Today}");

So cake will cancel with:
Program.cs(9,31): error CS1056: unecpected character '$'.

@wuerzi2000 It would be even better to just use a C#8 feature like ranges to really make sure it works correctly. I am already working on a PR for the whole fix.

Is it possible to add fix for this earlier than 0.34 milestone is completed? e.g. to fix default toolpath with 0.33.1 for example?

Was this page helpful?
0 / 5 - 0 ratings