-
Notifications
You must be signed in to change notification settings - Fork 976
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
A blank .NET Core 3.1 WinForms app, published as self-contained and trimmed, still bundles all WPF DLLs #3723
Comments
@danmosemsft can you help route this one? |
@joperezr thoughts about where this should go? |
A couple of thoughts here:
|
@joperezr, thanks for your thoughts. I've just tried it with the .NET SDK 5.0.100-preview.7 and it still bundles the WPF assemblies. That was very easy to do under Windows Sandbox, using the same two commands from the "Minimal repro" section in my report. Also, for the sake of trying, I deleted I suppose I'll have to move on and package it as is for my otherwise lightweight WinForms app. One other option I considered was to back-port it to NET 4.8 to keep the download size to a minimum, but I really like using the modern .NET and C# 8+. |
To follow up on what @joperezr said above - The reason all the You can see that by the <KnownFrameworkReference Include="Microsoft.NETCore.App"
TargetFramework="netcoreapp5.0"
RuntimeFrameworkName="Microsoft.NETCore.App"
DefaultRuntimeFrameworkVersion="$(MicrosoftNETCoreAppDefaultRuntimeFrameworkVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)"
TargetingPackName="Microsoft.NETCore.App.Ref"
TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)"
RuntimePackNamePatterns="Microsoft.NETCore.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@(NetCoreRuntimePackRids, '%3B')"
IsTrimmable="true"
/> The <KnownFrameworkReference Include="Microsoft.WindowsDesktop.App"
TargetFramework="netcoreapp5.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
DefaultRuntimeFrameworkVersion="$(MicrosoftWindowsDesktopAppDefaultRuntimeFrameworkVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftWindowsDesktopAppRuntimePackageVersion)"
TargetingPackName="Microsoft.WindowsDesktop.App.Ref"
TargetingPackVersion="$(MicrosoftWindowsDesktopAppRefPackageVersion)"
RuntimePackNamePatterns="Microsoft.WindowsDesktop.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@(WindowsDesktopRuntimePackRids, '%3B')"
IsWindowsOnly="true"
/> So if we wanted to allow WPF apps to trim WinForms assemblies, and vice-versa, we would need to set cc @sbomer |
Cant people who consume these do |
Is this a possible thing we can look forward for .NET 7.0? :) most WinForms libraries don't seem to be trimmable, although there seem to be some progress in the NativeAOT department with the ComWrappers repo going mainline someday soon. |
@LakshanF Is this fixed now? |
Yes, dotnet/sdk#39402 and dotnet/windowsdesktop#4227 should have addressed this. |
@Olina-Zhang can your team please test this so we can resolve it? |
@LakshanF we are still including |
Removed the WinForms profile in the PR, dotnet/windowsdesktop#4462 |
I want to note that any change made here will be .NET 9 only -- we don't make product feature changes in servicing. Also, 3.1 is out of support, you shouldn't be using it at all, under any circumstances. |
@LakshanF Verified this issue with WPF application, screenshot as below, but cannot run .exe file using both cmd and double click in file explore. Event Viewer has the application error. |
WPF and WinForms applications are not supported in trimmed mode. This change impacts default WinForms and WPF applications in self-contained mode, and published |
@MelonWang1 maybe raise an issue in the WPF repo to let them know? Once windows desktop propagates, we can retest and close this. @LakshanF should it be included in the next nightly update? |
N/A
Problem description:
A blank 3.1 WinForms app, published as self-contained and trimmed, still bundles all WPF assemblies, which adds at least extra 12MB.
Expected behavior:
WPF assemblies (
Presentation*.dll
etc) should not be included if the are not used.Minimal repro:
Note all
Presentation*.dll
The text was updated successfully, but these errors were encountered: