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

Most recent build tools update broke support for building on VS2017 #7592

Closed
tannergooding opened this issue Mar 9, 2017 · 22 comments
Closed
Assignees
Milestone

Comments

@tannergooding
Copy link
Member

The following commit broke support for building on VS2017: 8f23fca. Note: The support for building on VS2017 was validated before the commit, but was actually merged just after the aforementioned was merged.

The failure resembles the following:

D:\coreclr\Tools\Microsoft.CSharp.Core.targets(106,11): error MSB4064: The "OverrideToolHost" parameter is not suppo
rted by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property. [D:
coreclr\src\mscorlib\ref\mscorlib.csproj]

I have confirmed that reverting the commit resolves the issue (but I don't think we should revert it). Instead, we should find out what in the new toolset has broken the VS2017 support and update the toolset again.

@tannergooding
Copy link
Member Author

@chcosta, @gkhanna79

@tannergooding
Copy link
Member Author

Also FYI. @agocke, @jaredpar from the Roslyn Compiler Team, as they may be able to assist in the diagnosis.

@chcosta
Copy link
Member

chcosta commented Mar 9, 2017

I can't repro this at the moment. I don't get very far when trying to build in a VS2017 developer command prompt.

BUILD: Commencing build of native components for Windows_NT.x64.Release
BUILD: Using environment: "D:\VisualStudio2017\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26228.4
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
BUILD: Regenerating the Visual Studio solution
CMake Error: Could not create named generator Visual Studio 15 2017 Win64

Generators
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 8 2005 [arch]  = Generates Visual Studio 2005 project files.
                                 Optional [arch] can be "Win64".
  Visual Studio 7 .NET 2003    = Deprecated.  Generates Visual Studio .NET
                                 2003 project files.
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.

BUILD: Error: failed to generate native component build project

@tannergooding
Copy link
Member Author

@chcosta, the Windows Build instructions (https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md) were updated this morning to include the minimum install requirements for VS2017.

@chcosta
Copy link
Member

chcosta commented Mar 9, 2017

Following those instructions has not affected my build result in any way. :(

@tannergooding
Copy link
Member Author

Ah, I see. The version of CMAKE you have installed doesn't support VS2017. The instructions should probably explicitly call out whichever version added that support (not sure off the top of my head).

@tannergooding
Copy link
Member Author

Looks like 3.7.2 is the minimum required CMAKE version, which matches what the documentation says. Is that what version you are on @chcosta?

@chcosta
Copy link
Member

chcosta commented Mar 9, 2017

My bad, I only got through the VS2017 section. I'm on 3.6.1. Perhaps you can add a note to the VS2017 section and explicitly call that out?

@chcosta
Copy link
Member

chcosta commented Mar 9, 2017

It looks like the MSBuild v15.0 toolset has defined CSharpCoreTargetsPath differently.

In MSBuild v14.0, Microsoft.CSharp.CurrentVersion.targets would import Microsoft.CSharp.Core.targets which was in the same directory.

     <PropertyGroup>
        <CSharpCoreTargetsPath Condition="'$(CSharpCoreTargetsPath)' == ''">Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
    </PropertyGroup>

In MSBuild v15.0, if CSharpCoreTargetsPath is not defined, then it looks in RoslynTargetsPath.

    <PropertyGroup>
        <CSharpCoreTargetsPath Condition="'$(CSharpCoreTargetsPath)' == ''">$(RoslynTargetsPath)\Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
    </PropertyGroup>

For us, this leads to a mismatch because the Roslyn path we use in buildtools is not on MSBuild v15.0. You can work around the issue by explicitly specifying /p:CSharpCoreTargetsPath=Roslyn\Microsoft.CSharp.Core.targets. Obviously, that's not a long-term fix for this.

@tannergooding
Copy link
Member Author

@chcosta, I'm not familiar with the buildtools setup (it kind-of looks like we are manually doing a lot of MSBuild stuff, rather than just allowing the CompilerToolset to do it for us), but is there any reason why we can't modify the targets to check the VisualStudioVersion and set CSharpCoreTargetsPath if we are on VS2017?

@chcosta
Copy link
Member

chcosta commented Mar 9, 2017

+ @weshaggard

@chcosta
Copy link
Member

chcosta commented Mar 9, 2017

Also note, that I didn't actually look at what changed in BuildTools between the last update (around 1/9), and my change. I only looked into the problem as it exists today.

@weshaggard
Copy link
Member

@agocke, @jaredpar can one of you guys share the best approach to override the Roslyn compiler?

@jaredpar
Copy link
Member

Are you trying to override the compiler only or the compiler + build task?

For both here is a pointer to how we do it for our own builds. If this stops working we can't check in so it's probably a good item to depend on 😄

https://github.com/dotnet/roslyn/blob/master/build/Targets/Settings.props#L121

@weshaggard
Copy link
Member

We will need to override the compiler and build task in order to use the latest and greatest compiler features. We will try and use the same pattern you guys are doing.

@weshaggard
Copy link
Member

@chcosta can you please try setting the CSharpCoreTargetsPath to the right location in BuildTools targets files where we import the other changes.

@benaadams
Copy link
Member

Using

build all x64 Checked Release skiptests /p:CSharpCoreTargetsPath=Roslyn\Microsoft.CSharp.Core.targets

Fails differently with Error: Parameter not recognized: x64. 😢

BUILD: Commencing build of native components for Windows_NT.x64.Release
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26228.9
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
BUILD: Regenerating the Visual Studio solution
-- VS_PLATFORM_TOOLSET is v141
-- VS_PLATFORM_NAME is x64
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Work/GitHub/coreclr/bin/obj/Windows_NT.x64.Release
Tools are already initialized.
Running: D:\Work\GitHub\coreclr\Tools\dotnetcli\dotnet.exe D:\Work\GitHub\coreclr\Tools\run.exe D:\Work\GitHub\coreclr\config.json build -Project=D:\Work\GitHub\coreclr\bin\obj\Windows_NT.x64.Release\install.vcxproj -MsBuildLog=/flp:Verbosity=normal;LogFile="D:\Work\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Release.log" -MsBuildWrn=/flp1:WarningsOnly;LogFile="D:\Work\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Release.wrn" -MsBuildErr=/flp2:ErrorsOnly;LogFile="D:\Work\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Release.err" -configuration=Release  -BuildOS=Windows_NT -BuildType=Release -BuildArch=x64  x64 Release  skiptests /p:CSharpCoreTargetsPath
Error: Parameter not recognized: x64.
Our dev workflow has changed! Use -? for help in the new options we have and how to pass parameters now.
BUILD: Error: native component build failed. Refer to the build log files for details:
    "D:\Work\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Release.log"
    "D:\Work\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Release.wrn"
    "D:\Work\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Release.err"
BUILD: Builds failed:
BUILD:     x64 Checked  skiptests /p:CSharpCoreTargetsPath
BUILD:     x64 Release  skiptests /p:CSharpCoreTargetsPath

@chcosta
Copy link
Member

chcosta commented Mar 16, 2017

The problem you're hitting is using all in combination with x64, checked, and release. try one of these

build all skiptests -- /p:CSharpCoreTargetsPath=Roslyn\Microsoft.CSharp.Core.targets

build x64 checked skiptests -- /p:CSharpCoreTargetsPath=Roslyn\Microsoft.CSharp.Core.targets

build x64 release skiptests -- /p:CSharpCoreTargetsPath=Roslyn\Microsoft.CSharp.Core.targets

@benaadams
Copy link
Member

@chcosta yep doing checked and release separately fixes it; thank you

@gkhanna79
Copy link
Member

@chcosta Is there an ETA for this?

@chcosta
Copy link
Member

chcosta commented Mar 21, 2017

Later this week. It is still near the top of my list

@JosephTremoulet
Copy link
Contributor

This same error seems to have crept back in sometime in the past several days.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants