Tracking: .NET Core Sdk in Build Tools Installer
After installing Build Tools for Visual Studio 2017 RC (download URL: vs_BuildTools.exe), MSBuild.exe cannot be directly used because the Sdks are missing. A workaround is to provide them thanks to the MSBuildSDKsPath variable:
$ set MSBuildSDKsPath=C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Sdks
Are Build Tools supposed to be used for .NET Core? If this is the case, then the MSBuildSDKsPath variable should be better documented. If not (because they are replaced by .NET CLI?), it could be mentioned in https://www.visualstudio.com/downloads/#d-build-tools.
No, the Build Tools installer doesn't currently cover .NET Core scenarios. At some point in the future I hope we can have a .NET Core checkbox within it, but that's not done at the moment.
The dotnet SDK installer (with the CLI) doesn't replace the Build Tools installer, but it is the best current analog for it in some situations, like "what should I install on my CI server?" It is reasonable to install both.
/cc @srivatsn
Changing this to a tracking issue for "there should be a .NET Core checkbox in the Build Tools installer". The actual work will probably happen in the internal VS repo.
Related: https://github.com/NuGet/Home/issues/3660 (getting NuGet restore into the Build Tools installer).
this is terrible. what's the point of the Build Tools installer, if it isn't to install tools required to build .NET projects?
this is a regression, too. building dotnet core apps worked fine with the v14 build tools. again, this is a breakage of an existing, deployed-to-production scenario.
now we have the v15 tools looking for "Sdk.props" in one directory, and the dotnet SDK isntalling it into some completely different directory.
it's as if one hand isn't talking to the other.
really sloppy guys, really sloppy.
The solution to using msbuild to compile vs2017 csproj files is to not use msbuild, but to use dotnet instead. So on the build server you need ot install the dotnet sdk, since it comes with the sdks needed by the new vs2017 csproj file, and it comes with nuget. The msbuild install does not.
So, instead of
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" continuousIntegration.msbuild /t:deploy
Use
"C:\Program Files\dotnet\dotnet.exe" msbuild continuousIntegration.msbuild /t:deploy
What about asp.net core projects targeting .net framework (not .net core). Can such solutions be built with vs2017 built tools?
Not out of the box. You have to copy/paste the sdk folder from a machine that has vs2017 installed to the ci machine, and then it's probably a good idea to put them in the location where msbuild is looking for them, instead of messing about with environment variables.
it's probably a good idea to put them in the location where msbuild is looking for them
and where is it?
Copy the contents of this folder:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks
To
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks
Instead of copying over the SDK files, you should also be able to set an MSBuildSDKsPath environment variable to your C:\Program Files\dotnet\sdk\1.0.0\Sdk folder in your CI setup (if the CLI is installed).
gotta say, msbuild's loose dependencies lead to so many headaches... it looked like the single responsibility principal was getting followed with the independent with the dotnet tools, but we just took a step back to the msblob that rules them all... who decided the csproj solution was fully baked? please tell them this is an absolute pain.
Please solve this problem: (1) Installing Visual Studio Professional Enterprise (2) Changing the path of 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks' (Professional o Enterprise) (3) Build the solution
I think you are missing what the intent of my ask: I shouldn't need visual studio installed on my build machine: I should only need msbuild to build my project, not a full IDE
I agree with you @ntregillus , but for now is the most viable solution. Hope this can help you!
unfortunately it doesn't. I do not have enough licenses to install the IDE onto my build machine. Even if I could, I am not an administrator to install software on our build machine....
I will hold off on this nuget packaging for the core library until the standalone build tools can function independent of a IDE install.
Does this issue also prevent from even building a simple netstandard project (read "a project using the new csproj format") on a build machine without installing vs 2017 enterprise ?
For now, it requires to copy C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks to build server and also C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet to enable /t:Restore target.
No, i can still build vs2017 projects, using the msbuild tools. I have a number of .net core web apps that I would like to utilize this functionality for however
There's a reasonably clear path forward here for the 15.3/.NET CLI 2.0 timeframe. MSBuild has implemented SDK Resolvers #2002, which allow MSBuild and Visual Studio to use the .NET Core SDK installed in Program Files. It does require placing a resolver assembly in the MSBuild instance folder, though, and the work to do so even for the Build Tools installer isn't yet completed.
Is it still required to have he NuGet VSIX in the build tools to reasonably build for all combinations of packages.config/ProjectReference, classic/SDK-based csproj? While slacking with @tbolon, he mentioned copying C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet was necessary as well to get his build running..
Then there is C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\SolutionFile\ImportAfter\Microsoft.NuGet.Solution.ImportAfter.targets as well for restore on solutions to work.. don't know if it's in the build tools but it could be bad if that is out of sync with the individual project's SDK versions