-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Bootstrap MSBuild unable to build console projects: unable to resolve workload SDKs #7988
Comments
Nothing seems to be logging anything into the SdkLogger. This is never used for anything:
|
It would be nice to prioritize this, because every release MSBuild ships, it ships being unable to work on an empty machine without the SDK installed. If it continues to be broken, we will be unable to just walk up to the MSBuild repo, build bootstrap and expect that it just works on any machine. I normally like building and archiving bootstrapped MSBuild for every release, but the last working one I have is from 17.2 or something. This is also useful for bisecting, to answer questions like "which MSBuild release did this break in?" |
@baronfel I'd love to see this fixed at some point |
Latest messages from bootstrap MSBuild 17.8.3:
|
Related to #6566, maybe msbuild/eng/BootStrapMSBuild.targets Lines 258 to 260 in 5cf7858
|
@JanKrivanek if there was one MSBuild issue that I'd love to see fixed the most, it's this one It's super important for standalone bootstrap MSBuild to be able to build projects, and it's currently not working. It's super important to be able to check out any commit of MSBuild, build bootstrap and be able to use that MSBuild to build real projects. |
I'll venmo $100 to whoever fixes this. |
This is a long standing issue and I just wanted to dig what is this about(also good motivator 💰 😄 ) I did not understand the full picture but I just download the source of this repo to a new(empty) windows installation and ran the build command, got the error below Microsoft.Build.Utilities -> C:\Users\vboxuser\msbuild-main\artifacts\bin\Microsoft.Build.Utilities\Debug\netstandard2.0\Microsoft.Build.Utilities.Core.dll
C:\Users\vboxuser\msbuild-main\.tools\msbuild\17.8.5\tools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3345,5): error MSB3821: Couldn't process file system.design\system.design.txt due to its being in the Internet or Res
tricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files. [C:\Users\vboxuser\msbuild-main\src\Tasks\Microsoft.Build.Tasks.csproj::TargetFramework=net8.0]
StringTools -> C:\Users\vboxuser\msbuild-main\artifacts\bin\StringTools\Debug\net35\Microsoft.NET.StringTools.net35.dll
StringTools.UnitTests -> C:\Users\vboxuser\msbuild-main\artifacts\bin\StringTools.UnitTests\Debug\net472\Microsoft.NET.StringTools.UnitTests.dll
Microsoft.Build.UnGAC -> C:\Users\vboxuser\msbuild-main\artifacts\bin\Microsoft.Build.UnGAC\Debug\net45\Microsoft.Build.UnGAC.exe
StringTools.UnitTests -> C:\Users\vboxuser\msbuild-main\artifacts\bin\StringTools.UnitTests\Debug\net8.0\Microsoft.NET.StringTools.UnitTests.dll
StringTools.UnitTests.net35 -> C:\Users\vboxuser\msbuild-main\artifacts\bin\StringTools.UnitTests.net35\Debug\net472\Microsoft.NET.StringTools.net35.UnitTests.dll
C:\Users\vboxuser\msbuild-main\.tools\msbuild\17.8.5\tools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3345,5): error MSB3091: Task failed because "resgen.exe" was not found, or the correct Microsoft Windows SDK is not i
nstalled. The task is looking for "resgen.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx3
5Tools-x86. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct
location into the "ToolPath" parameter of the task. [C:\Users\vboxuser\msbuild-main\src\MSBuildTaskHost\MSBuildTaskHost.csproj]
StringTools.Benchmark -> C:\Users\vboxuser\msbuild-main\artifacts\bin\StringTools.Benchmark\Debug\net472\StringTools.Benchmark.exe
StringTools.Benchmark -> C:\Users\vboxuser\msbuild-main\artifacts\bin\StringTools.Benchmark\Debug\net8.0\StringTools.Benchmark.dll
Build FAILED.
C:\Users\vboxuser\msbuild-main\src\Directory.Build.targets(137,5): error : TlbExp was not found. Ensure that you have installed everything from .vsconfig. If you have, please report a bug to MSBuild. [C:\Users\vboxuser\msbuild-main\src\
Framework\Microsoft.Build.Framework.csproj::TargetFramework=net472]
C:\Users\vboxuser\msbuild-main\.tools\msbuild\17.8.5\tools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3345,5): error MSB3821: Couldn't process file system.design\system.design.txt due to its being in the Internet or Res
tricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files. [C:\Users\vboxuser\msbuild-main\src\Tasks\Microsoft.Build.Tasks.csproj::TargetFramework=net8.0]
C:\Users\vboxuser\msbuild-main\.tools\msbuild\17.8.5\tools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3345,5): error MSB3091: Task failed because "resgen.exe" was not found, or the correct Microsoft Windows SDK is not i
nstalled. The task is looking for "resgen.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx3
5Tools-x86. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct
location into the "ToolPath" parameter of the task. [C:\Users\vboxuser\msbuild-main\src\MSBuildTaskHost\MSBuildTaskHost.csproj]
0 Warning(s)
3 Error(s)
Time Elapsed 00:00:25.76
Build failed with exit code 1. Check errors above. Sorry for my ignorance. Are we trying to fix the this build.cmd process or are we trying to fix the dotnet project generator ? |
@ozkanpakdil neither, you should be able to build this repo either way. Try cloning the repo instead of downloading a zip file (or Unblock the zip file in the file properties before extracting the files). The scenario to be fixed is described in the OP, it's running the msbuild itself to compile a blank project. I run into this issue myself trying to compile a .NET project on a machine that has .NET SDK binaries only, i.e. not installed by the installer. |
If an SDK is a workload SDK, and we don't have the workload SDK resolver from the SDK, as, for instance, if we have an xcopy'd MSBuild, then we should still be able to build simple projects that don't require workloads. Right now, we just fail. If we get into a failure state, this tries to figure out if we actually need workloads, erring on the side of failing if we aren't sure. If we decide we don't need workloads, however, we suppress the error for failing to load a workload SDK. Fixes dotnet#7988
This has been long done for .NET (core); extend it to the location that the .NET Framework copy of the SDK resolver looks for it too. Fixes dotnet#7988.
@miloush Can you elaborate please? The SDK zips should work fine. |
I download the SDK binaries and put them in a folder. Then when I want to compile a project either I can use MSBuildSDKsPath environment to point to the folder (for the default resolver), or I explicitly include the SDK props and targets files via Either way, I get
|
Using what MSBuild, @miloush? |
Any recent MSBuild since 2022, specifically I think bootstrap built from 17.8.3 |
@KirillOsenkov AFAICT @miloush is describing a different problem. You are wanting #10112. |
Hm, appears to be |
@miloush that is old to use a new SDK like 8.0.204. I don't think I'd expect that combination to work. In addition if you want to use a .NET Framework MSBuild (VS/msbuild.exe) with a zip SDK, I think you'd need to set some of the more specific environment variables ( |
@rainersigwald when I install the SDK, I get
so I would expect that too without installation, instead I get the unresolved SDKs error above. I will try to see how it looks like with a newer msbuild. |
This has been long done for .NET (core); extend it to the location that the .NET Framework copy of the SDK resolver looks for it too. Closes #7988.
It works! But also need to drop the sentinel for amd64. I can do it. |
Setting |
I am pretty sure I tried to set |
Sorry about the delay, I have the setup back. MSBuildSDKsPath set to ...\dotnet-sdk-8.0.204-win-x64\sdk\8.0.204\Sdks\ The compilation results in error:
|
@miloush don't set |
OK This is not a trivial knowledge, and some instructions should be included either at the SDK download page or in the zip archive. Thanks for help! |
It has to work after merging #10300 |
"It has no work" - could you please clarify? |
I apologize for the typo, it has TO work now :D |
Prep a bootstrap MSBuild layout using
build /p:CreateBootstrap=true
or download the one I used from:
https://kirillosenkovfiles.blob.core.windows.net/kirillosenkovblob/msbuild.17.3.1.zip
Be on an empty Windows machine, such as Windows Sandbox VM
Create and build a new C# console app targeting net472
Expected: builds successfully
Actual:
The two SDKs it can't resolve:
First off, the error messages are inadequate - they don't mention the SDK reference that failed to resolve.
Both of these are supposed to resolve from:
https://github.com/dotnet/sdk/blob/3dc5e528fffc050cace4cff8bc32954eb33f0455/src/Resolvers/Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver/CachingWorkloadResolver.cs#L121-L136
However on an empty machine with just the xcopied MSBuild something goes awry apparently and it fails with the obscure messages above.
Until recently, the bootstrap MSBuild was xcopyable, meaning it used to build desktop-targeting projects on a completely empty Windows machine.
At some point this regressed. It is crucial that we continue to be able to have xcopyable MSBuild and we should move towards making MSBuild more portable, not less.
The text was updated successfully, but these errors were encountered: