Remove .NETCore <3.0 as SupportedTargetFrameworks for WinForms and WPF #1567
Labels
Enhancement Requested
Product code improvement that does NOT require public API changes/additions
tell-mode
Issues and PR's that require notice to .NET Core Shiproom
Milestone
This issue tracks WPF's portion of the work.
--
@etbyrd commented on Thu Jul 18 2019
The Project System needs a way to know the correct SupportedTargetFrameworks for WinForms and WPF projects so we can display the correct TFM's in the property pages.
Is it possible that this can be done on the SDK side?
dotnet/project-system#5010
cc @nguerrera
@nguerrera commented on Thu Jul 18 2019
cc @vatsan-madhavan @rladuca
@nguerrera commented on Thu Jul 18 2019
cc @dsplaisted
@nguerrera commented on Thu Jul 18 2019
Today we have a static list of supported TFMs here:
https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetFrameworks.props
What I'm thinking is that the WindowsDesktop SDK could override this somehow to remove the target frameworks that it doesn't support.
Simplest form of that would be to do some
Removes
but then I think we want no versions of .NET Standard to be supported, and then we'd have a maintenance problem when say .NETStandard 2.2 came out and wasn't yet removed.Another way would be for WindowsDesktop SDK to remove all and have its own fixed allow-list. But then it is in the business of taking an update for every version.
Finally, we could make the list above dynamic based on whether the WindowsDesktop SDK has set certain props.
What do you all think would be best?
@vatsan-madhavan commented on Thu Jul 18 2019
I don't understand the request for the SDK.
We already have logic for handling TFM < 3.0 && TargetFrameworkIdentifier==.NETCoreApp. What specifically is being requested here?
See _WindowsDesktopFrameworkRequiresVersion30 - currently there is a warning shown when someone tries to use WindowsDesktop SDK and sets TFM < netcoreapp3.0
@vatsan-madhavan commented on Thu Jul 18 2019
Spoke too soon.. thanks for the context.
@nguerrera commented on Thu Jul 18 2019
The request is that the list of SupportedTargetFramework: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetFrameworks.props
not include target frameworks that aren't supported by windows desktop projects. VS uses these items to populate a retargeting drop-down in property pages.
@vatsan-madhavan commented on Thu Jul 18 2019
Remove
-ing these is easy, and doesn't pose maintainability problems.I would expect 3.0+
.NETCoreApp
TFM's to be supported.If we don't want any version of
.NETStandard
to be supported, is there a way we canRemove
them all without having to run aTarget
? That would probably be the easiest thing to do... For e.g., if we could coordinate a change with dotnet/sdk and have it define@(_NetStandardSupportedTargets)
inMicrosoft.NET.SupportedTargetFrameworks.props
, we could probably use that and easily eliminate .NET Standard TFM's.Thoughts?
@vatsan-madhavan commented on Thu Jul 18 2019
How come this list doesn't include
.NETFramework
items? Is that because SDK-style projects "work with, but don't support" .NET Framework?@nguerrera commented on Thu Jul 18 2019
Good question about .NET Framework. I suppose that is why. @davkean?
@nguerrera commented on Thu Jul 18 2019
I think I like where you were going we could have this:
Another idea would be to set the metadata with the TargetFrameworkIdentifier and Version separated. I think this would let you do the removes with conditions that match all .NET Standard, though I have to check what is possible in evaluation here. We can't use a target for any of this.
@vatsan-madhavan commented on Thu Jul 18 2019
I don't think metadata will work - though I wish that it did.
@vatsan-madhavan commented on Thu Jul 18 2019
We should probably do this, IMO, like you described above:
Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetFrameworks.props
Microsoft.NET.Sdk.WindowsDesktop.props
@nguerrera commented on Thu Jul 18 2019
That works for me.
(I assume the 0 in SupportedTargetFramework0 is a typo.)
@vatsan-madhavan commented on Thu Jul 18 2019
yeah, typo ...
@nguerrera commented on Thu Jul 18 2019
@davkean Any concerns here? Shall we go ahead?
@vatsan-madhavan commented on Thu Jul 18 2019
Do we need a separate issue to puzzle out whether to add .
NETFramework
toSupportedTargetFramework
items in Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetFrameworks.props ?Unless we have documented it as unsupported, I'm starting to think that it ought to be supported.
The very first example at How to: Use MSBuild project SDKs shows how to target .NET 4.6 using SDK style project. Additions to the csproj format for .NET Core also describes how to leverage it for .NET Framework. These seem to suggest strongly that the SDK style projects are both supported and encouraged for use by .NET Framework projects.
@nguerrera commented on Thu Jul 18 2019
I assume the project system doesn't use this data for .NET Framework and instead looks in a more classical place for versions of .NET Framework to offer. I'm fine adding it, but if it's not going to be used, it doesn't seem to be high priority.
@vatsan-madhavan commented on Thu Jul 18 2019
If the project system doesn't use it, then I agree that it doesn't matter. We should probably add a comment that .NET Framework is missing because the project system doesn't use it...
@nguerrera commented on Thu Jul 18 2019
.NET Framework is supported by us. In fact, ASP.NET Core 1.x, 2.x projects could even target .NET Framework from File -> New Project.
@nguerrera commented on Thu Jul 18 2019
It already shows the full list:
It is quite possible that the oldest ones in that list don't work so maybe we should get them out of there?
@vatsan-madhavan commented on Thu Jul 18 2019
If the project system used SupportedTargetFrameworks, this would be so easy ;-)
@davkean commented on Wed Jul 24 2019
We can use it for desktop, assuming you won't return < .NET Framework 3.0 for WPF/
WInForms? It would be great if you return all of the TFMs from all frameworks so that we can switch between .NET Framework -> .NET Core as we've had quite a few bugs on this.@nguerrera commented on Wed Jul 24 2019
@davkean OK, we can add supported .NET Framework TFMs with the same pattern and WindowsDesktop can remove accordingly there too.
So you're good with this plan?
@davkean commented on Wed Jul 24 2019
Yep, does this overlap with the existing infrastructure we already use to retrieve the frameworks?
@vatsan-madhavan commented on Wed Jul 24 2019
Why not WinForms?
@davkean commented on Wed Jul 24 2019
WinForms is supported on .NET Framework 2.0.
@vatsan-madhavan commented on Wed Jul 24 2019
Ah, got it. We have the right rules in place for WinForms for that in WindowsDesktop SDK.
@nguerrera We should see if we can do this correctly for WindowsDesktop.WindowsForms (netfx 2.0+) vs. WindowsDesktop.WPF vs. WindowsDesktop (same as WPF).
@davkean commented on Mon Aug 05 2019
What's the state of this? Is this ready to be consumed?
@nguerrera commented on Mon Aug 05 2019
Not yet. We have approval to go ahead. I'm a bit slammed on more critical issues. @livarcocc can you possibly see if someone else can pick this up?
@peterhuene commented on Wed Aug 07 2019
I'll go ahead with implementing this in the SDK.
@peterhuene commented on Wed Aug 07 2019
I assume WindowsDesktop would want this in their props (for completeness):
@peterhuene commented on Wed Aug 07 2019
I've created PR #3516 for the SDK side of the changes.
@vatsan-madhavan commented on Wed Aug 07 2019
Nice!
We have to obviously wait until an SDK containing this change flows into dotnet/wpf - which can be a few hours or a few days...
@peterhuene commented on Wed Aug 07 2019
I've verified my suggestion for the Windows Desktop props above with VS (16.3 preview). With both the SDK change and that one, Visual Studio only shows netcoreapp3.0 in the drop down.
@nguerrera commented on Wed Aug 07 2019
There was some discussion of adding supported .NET Framework to this above. But given that VS doesn't use that today, I think it is fine to do later. Should we open a separate issue to track that?
@peterhuene commented on Wed Aug 07 2019
Ah I missed that part. I can add that to this change now rather than deferring that work.
Do we have a list of the expected supported .NET Framework TFs?
@nguerrera commented on Wed Aug 07 2019
I don't know. I'm pretty sure older ones and client platform don't work. @dsplaisted Do we have a list?
@nguerrera commented on Wed Aug 07 2019
I'm guessing we should use the same set as what was used for the full framework targeting packs as nupkgs? Where is that?
@vatsan-madhavan commented on Wed Aug 07 2019
For WPF and WinForms, the .NET Framework support list can be found indirectly at
wpf/packaging/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.props
Line 77 in 8a23402
In short,
The exact reference set varies from net30, net35 to net40, net45 etc. , but they are all supported all the way to net48.
dotnet
for TFM net40+dotnet
has trouble finding ref-assemblies for net30, net35. If they are supplied carefully in the projects, they build as well. (I tried this a while back but did not check again now). I think it suffers from Cannot find reference assemblies for .NET 3.5 or lower using core msbuild msbuild#1333There are corner cases that need some special handling. For e.g., if you try to use
SplashScreen
withnet30
, you'll get an build-error (unsupported), but those are small issues.The text was updated successfully, but these errors were encountered: