-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Set PlatformTarget to AnyCPU for modern .NET #48599
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
base: main
Are you sure you want to change the base?
Conversation
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
Outdated
Show resolved
Hide resolved
Thanks for starting this! It looks like the tests got removed in one of the more recent commits, though? |
…imeIdentifierInference.targets Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
Show resolved
Hide resolved
Modern .NET assemblies don't rely on the platform bit in the binary; they're CPU-agnostic, | ||
and the JIT determines the actual architecture behavior at runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modern .NET assemblies don't rely on the platform bit in the binary; they're CPU-agnostic, | |
and the JIT determines the actual architecture behavior at runtime. | |
Outside .NET Framework, PlatformTarget does not have a real purpose since the process architecture is | |
determined by the host used to launch the application. Defaulting to AnyCPU naturally works on all platforms | |
where modern .NET is supported and makes it unnecessary to recognize these platforms as PlatformTargets. |
JIT does not determine the actual architecture. The actual architecture is determined by the host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you verify the impact of this on VSTest?
For modern .NET, we determine which testhost will be copied to output directory based on that.
I think the usage in VSTest is bad, but we need to understand how we will approach handling this breaking change.
It's also passed to VSTestTask here:
https://github.com/microsoft/vstest/blob/dbcd471883202088496ab81d3ec2d3f3be0981b5/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets#L53
But for the specific usage in this task, I don't know if it's .NET Framework only or if it also affects .NET Core. @nohwnd will be the best contact here.
Fixes #42558.
cc @jkotas, @baronfel