-
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
x64 MSBuild is getting CLR quirks for .NET 4.0 behaviors #5331
Comments
Can you provide some repro steps? what kind of project are you building? How exactly are you launching MSBuild? |
In my case, we use bob (build automation tool) which uses e.g. CMake to build windows binaries. CMake calls the msbuild by using the CMake VS2019 generators. refer: #53 (comment)
more references: refer: #53 (comment)
refer: #53 (comment)
But, generally I guess, we don't need any special use-case to reproduce - I guess there is no case, where the issue doesn't occurs if the paths just long enough. |
@benvillalobos, can you try to repro? |
@benvillalobos could you please 👍 |
This comment has been minimized.
This comment has been minimized.
@mahaase (or anyone): Can you try patching your diff --git a/src/MSBuild/app.amd64.config b/src/MSBuild/app.amd64.config
index f37149aca..c2023dc93 100644
--- a/src/MSBuild/app.amd64.config
+++ b/src/MSBuild/app.amd64.config
@@ -10,7 +10,7 @@
<DisableFXClosureWalk enabled="true" />
<DeferFXClosureWalk enabled="true" />
<generatePublisherEvidence enabled="false" />
- <AppContextSwitchOverrides value="Switch.System.Security.Cryptography.UseLegacyFipsThrow=false" />
+ <AppContextSwitchOverrides value="Switch.System.Security.Cryptography.UseLegacyFipsThrow=false;Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /> ? That appears to resolve the problem for me. |
For some reason, these overrides appear to be necessary on x64/amd64 .NET Framework. They were removed in dotnet#3960 because we thought they were redundant now, but that appears to only be the case on x86. Fixes dotnet#5331.
I can confirm that this makes the long path errors go away. If anyone needs a workaround for this in their CI system, the following step before building does the trick for our queue. - task: PowerShell@2
displayName: Fix LongPath bug in MsBuild
inputs:
targetType: 'inline'
script: |
$msbExeConfigPath="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin\amd64\msbuild.exe.config"
[ xml ]$msbExeConfig = Get-Content -Path $msbExeConfigPath
$msbExeConfig.configuration.runtime.AppContextSwitchOverrides.SetAttribute("value", "Switch.System.Security.Cryptography.UseLegacyFipsThrow=false;Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false")
$msbExeConfig.Save($msbExeConfigPath) |
For some reason, these overrides appear to be necessary on x64/amd64 .NET Framework. They were removed in #3960 because we thought they were redundant now, but that appears to only be the case on x86. Works around #5331, but ideally we'll figure out why we're not getting the defaults we should be for targeting 4.7.2.
@rainersigwald: Thank you so much for a quick turnaround! |
What a time to be alive! :) |
I'm actually going to reactivate this as a more general problem; Something™ is going wrong that's causing .NET Framework to give us the .NET 4.0 behaviors for everything instead of .NET 4.7.2+ . . . only in our x64 MSBuild.exe. I'm investigating with some CLR folks. |
These ran afoul of a .NET Framework bug that means that the base AppDomain gets .NET 4.0 behaviors instead of the modern defaults. Fixes #5331 (by working around https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1148752).
This turns out to be due to a bug in .NET Framework (internal link: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1148752). If you load an assembly that needs a The Runtime folks are going to look the underlying bug. Fortunately, we don't really need the |
These ran afoul of a .NET Framework bug that means that the base AppDomain gets .NET 4.0 behaviors instead of the modern defaults. Fixes #5331 (by working around https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1148752).
Any updates? long path is a real issue... |
I thought this was fixed in 16.9, but I still had the issue. I've examined some of the commits here and it seems it was once part of the code base, but then removed. Any reason why? Now the target release is 16.10... Btw, manually modifying |
up |
https://github.com/dotnet/msbuild/milestone/51 I don't see this issue here, where else I can check that target release is really 16.10 ? |
Fixes dotnet#5331 by explicitly specifying all quirks that the runtime should specify for us because we target .NET 4.7.2.
Hi, I was brought here by https://developercommunity.visualstudio.com/t/msbuild-editorconfig-filename-length-issues/1462559 And I had updated my <AppContextSwitchOverrides value="...... Switch.System.Security.Cryptography.UseLegacyFipsThrow=false;Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" /> But my VS still not able to build properly and showing
The error point to this line in Tried running Running Microsoft Visual Studio Community 2019 Version 16.11.1 |
I have this problem with Visual Studio Community 2022
I've tried patching the |
apologies. This wasn't (Setting the registry key via Apologies for the noise. |
@neominky please file a new issue describing your problem, including details about how you are launching the build. |
Already reported by @ariccio here: #53
but a new ticket, because of 64-bit variant isn't solved.
The text was updated successfully, but these errors were encountered: