cake-build / cake-build/cake

try resolve msbuild.exe before guessing it

Open
#2,181 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

```C#
#tool nuget:?package=vswhere
...
Setup(context =>
{

var msbuildToolsPath = VSWhereProducts("*", new VSWhereProductSettings { Requires = "Microsoft.Component.MSBuild"})
.FirstOrDefault()
?.CombineWithFilePath(@".\MSBuild\15.0\Bin\MSBuild.exe")
;

context.Tools.RegisterFile(msbuildToolsPath);
});

Task("Build-Solution")
.Does(() =>
{
MSBuild(solutionPath, settings =>
{
settings
.SetConfiguration(configuration)
.WithTarget("Restore")
.WithTarget("Rebuild")
.WithTarget("Pack")
;
});
});
```

The script above doesn't work because the `MSBuildRunner` doesn't provide a list of executable names to be resolved.

https://github.com/cake-build/cake/blob/main/src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs#L284-L287

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.