Skip to content
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

FAKE doesn't find MSBuild 15.0 (shipped with Visual Studio 2017) #1442

Closed
opcon opened this issue Dec 29, 2016 · 2 comments
Closed

FAKE doesn't find MSBuild 15.0 (shipped with Visual Studio 2017) #1442

opcon opened this issue Dec 29, 2016 · 2 comments

Comments

@opcon
Copy link

opcon commented Dec 29, 2016

Description

The MSBuildHelper module of FAKE does not find the correct executable for the MSBuild.exe shipped with Visual Studio 2017 RC (Community edition).

This is because MSBuild 15.0 (shipped with VS 2017 RC) is installed to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin, rather then a separate MSBuild folder in Program Files as with earlier versions.

Repro steps

  1. Have Visual Studio 2017 RC installed (I have the Community edition, but I imagine it affects others as well).

  2. Use the MSBuildHelper in a FAKE script to build a project, such as e.g.:

        !! (substructioDir + "src/**/*.csproj")
            |>
            match mode.ToLower() with
                | "release" -> MSBuildRelease "" "Build"
                | _ -> MSBuildDebug "" "Build"
            |> Log "AppBuild-Output:"

Expected behavior

FAKE script builds the project successfully.

Actual behavior

FAKE attempts to use the MSBuild.exe located in C:\Windows\Microsoft.NET\Framework\v4.0.30128\, due to the search paths listed here: https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/MSBuildHelper.fs#L25
which then fails because it uses an old version of MSBuild with C# 5 rather than C# 6

Known workarounds

My current workaround is to see if the Visual Studio 2017 MSBuild directory exists, and if so set the build parameter MSBuild to use that:

    if (directoryExists msbuild2017Location) then
        setBuildParam "MSBuild" msbuild2017Location

The fix would be to add the VS 2017 MSBuild folder to the search paths listed here: https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/MSBuildHelper.fs#L25

A separate entry may be needed for every edition of VS 2017 (Community, Professional, Enterprise)

Related information

  • Operating system: Windows 10
  • Branch: Master, FAKE 4.47.1
  • .NET 4.5
forki pushed a commit that referenced this issue Jan 15, 2017
Added MSBuild 15.0 locations to search paths as per @opcon's diagnosis.
@opcon's VS community installation was at [1]. I installed VS pro and it
ended up at [2]. Am guessing the "Enterprise" path.

[1] (ProgramFilesX86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
[2] (ProgramFilesX86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin
forki added a commit that referenced this issue Jan 15, 2017
MSBuild 15.0/VS 2017RC support (#1442)
@matthid
Copy link
Member

matthid commented May 7, 2017

This was added.

@gonzogonzales
Copy link

Just as Information the Github-Links does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants