-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSBuild doesn't support MSBuild 16 / VS 2019. #2271
Comments
As we now use /cc @vbfox |
I ran that in FSI, I get this result (I've now got VS 2017 installed): map [
(15.0, [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin])] There's no MSBuild.exe at that location in VS 2019 (the folder exists, it has a I suspect the regex needs modifying & maybe we should check if MSBuild.exe exists? Or is that implicitly happening later anyway? However, then we don't know the version, given all we have is 'Current'. |
I'm at work and can't easily PR today but something like that should work and keep compat: module MSBuildExeFromVsWhere =
open BlackFox.VsWhere
open System.Text.RegularExpressions
let private getAllVsPath () =
VsInstances.getWithPackage "Microsoft.Component.MSBuild" true
|> List.map (fun vs -> vs.InstallationPath)
let private getAllMsBuildPaths vsPath =
let versionsDir = Path.Combine(vsPath, "MSBuild")
if Directory.Exists(versionsDir) then
Directory.EnumerateDirectories(versionsDir)
|> Seq.map (fun d -> Path.Combine(d, "Bin", "MSBuild.exe"))
|> Seq.choose(fun exe ->
try
let v = FileVersionInfo.GetVersionInfo(exe)
Some (sprintf "%d.0" v.FileMajorPart, Path.GetDirectoryName(exe))
with
| _ -> None)
|> List.ofSeq
else
[]
let private all = lazy(
getAllVsPath ()
|> List.collect getAllMsBuildPaths
|> List.groupBy fst
|> List.map (fun (v, dirs) -> v, dirs |> List.map snd)
|> Map.ofList)
let get () = all.Value |
Looks good to me map [
(15.0, [C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin]);
(16.0, [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin])] |
@csmager can you send a PR? |
Will do this week! |
For calculating code metrics I have included Microsoft.CodeAnalysis.Metrics 2.9.4 nuget package to my csproj project. Then, from command line I am calling msbuild with /t:Metrics option: which ended with following error: It looks like Metrics.exe looking for msbuild in wrong location, but nuget.exe in correct one. |
Description
MSBuild doesn't support MSBuild 16 / VS 2019.
Repro steps
e.g.
MSBuild.runRelease
.Expected behavior
It should pick the latest installed version
Actual behavior
I have uninstalled VS 2017, what gets executed is MSBuild 14.
Known workarounds
Run with
MSBuild
environment variable, e.g.Related information
The text was updated successfully, but these errors were encountered: