dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.07k stars 1.17k forks source link

WPF publish adds Windows Forms dlls (including design time dlls) #6761

Open myblindy opened 2 years ago

myblindy commented 2 years ago

Describe the bug

As the title is, a plain WPF application seems to somehow publish the Windows Forms dlls, including the design time ones, which are both very large and (presumably) not necessary.

To Reproduce

  1. Clone https://github.com/myblindy/wpf-publish-issue and open the solution
  2. Create a basic self-contained publish to folder profile, mine was Windows-x64. Like this: image
  3. Publish to the folder
  4. Notice the WF dlls in the publish folder: image

Exceptions (if any)

N/A

Further technical details

PS C:\Program Files\Microsoft Visual Studio\2022\Preview> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   7.0.100-preview.1.22110.4
 Commit:    129d2465c8

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.100-preview.1.22110.4\

Host (useful for support):
  Version: 7.0.0-preview.1.22076.8
  Commit:  405337939c

.NET SDKs installed:
  2.1.500 [C:\Program Files\dotnet\sdk]
  5.0.404 [C:\Program Files\dotnet\sdk]
  6.0.300-preview.22204.3 [C:\Program Files\dotnet\sdk]
  7.0.100-preview.1.22110.4 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0-preview.1.22109.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0-preview.1.22076.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0-preview.1.22077.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Visual Studio 2022 Version 17.2.0 Preview 4.0, but this has been an issue for a long while, on both .Net 6 and 7 (haven't tried before that).

vijayrkn commented 2 years ago

Removing the websdk tag since this is not related to web or the Visual Studio publish. The same can be reproduced with dotnet publish.

Adding @LakshanF to see if this is something you can help with.

myblindy commented 2 years ago

Removing the websdk tag

Yeah, I was a bit surprised at that auto tag as well.

marcpopMSFT commented 2 years ago

Moving to WPF as I assume they control which files get published during the build.

wjk commented 2 years ago

FWIW, I’ve been running into this issue for a long time now coming from the other direction (pure Windows Forms app, still deploys completely unused WPF runtime libraries). I think it has something to do with runtime packs. Hope this helps!