-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Binding redirects should be enabled by default when target .NET Framework #1070
Comments
We have sdk/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.BeforeCommon.targets Line 46 in 1042b68
Which sets the first property when you are a .NET Framework Exe. Is there a way to tell when the project is a test project? I don't think we would want this on for every .NET Framework class library, would we? |
Logically you'll want to set it for everything that gets executed like an app, e.g. unit testing projects.
Not sure there is an easy way to do that; you could in theory detect references to popular unit testing frameworks, but that seems fragile. What's the harm in turning it always on for .NET Framework? Worst case the output folder contains an additional Tagging a few more folks for input. |
For <Project>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<CopyNuGetImplementations>true</CopyNuGetImplementations>
<DebugType Condition=""'$(TargetFrameworkIdentifier)' != '.NETCoreApp'"">Full</DebugType>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateDependencyFile>true</GenerateDependencyFile>
</PropertyGroup>
</Project> My understanding is that |
@Faizan2304 @codito to check that the test SDK is doing the right thing already. |
Related to #909 in that we don't treat desktop tests as exes but should for binding redirects and for RID inference. We should probably fix both together. |
The test SDK doesn't do this for you today. I just hit this myself. Turns out you can also workaround this by setting |
Perhaps we should have |
FWIW - we had a similar concept in project.json world: public bool HasRuntimeOutput(string configuration)
{
var compilerOptions = GetCompilerOptions(targetFramework: null, configurationName: configuration);
// TODO: Make this opt in via another mechanism
return compilerOptions.EmitEntryPoint.GetValueOrDefault() || IsTestProject;
}
public bool IsTestProject => !string.IsNullOrEmpty(TestRunner); |
This is a huge mistake in my opinion. People are already complaining to me about the fact that |
You just convinced me of that. |
So, what's the summary? I'm a bit at loss what you guys are proposing here. |
@terrajobst This is my proposal: #1070 (comment) |
Are there other names that would fit better?
It probably doesn't matter too much. Just wanted to throw it out there. |
I don't have a strong opinion about the name. All of those are workable to me. |
This will be fixed by #1178 once the test project sets HasRuntimeOutput to true, which is now tracked by microsoft/vstest#792 |
Any news on this issue? Was it shipped? |
…0191102.3 (dotnet#1070) - Microsoft.AspNetCore.Analyzers - 5.0.0-alpha1.19552.3 - Microsoft.AspNetCore.Mvc.Api.Analyzers - 5.0.0-alpha1.19552.3 - Microsoft.AspNetCore.Mvc.Analyzers - 5.0.0-alpha1.19552.3 - Microsoft.AspNetCore.Components.Analyzers - 5.0.0-alpha1.19552.3
…eaks Numerous fixes for Razor Pages project template
We don't support .NET Framework projects via SDK-style projets yet, but many of us are dog fooding this experience already. I had to add the following two lines to my project to get binding redirects in my unit testing project:
We should make sure this ends up in the default props so that customers don't have to know that -- they expect binding redirects to just work.
The text was updated successfully, but these errors were encountered: