dotnet / wpf

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

Reduce the binary size of the single file publish of .net core WPF #3070

Open AZ-X opened 4 years ago

AZ-X commented 4 years ago

I know there is some kind of long term planning of WPF with dot core. But a common scenario of x copy deployment independent of OS framework setup so called 'self-contained' is NOT acceptable due to its huge size. Look, I created my first GITHUB release of WPF App here: WPF-GO-dnscrypt-proxy-md The release zip package can be downloaded: WPF-dnscrypt-proxy-md-single-binary-release-can-run-without-dotnet-framework.zip It’s up to 43M while the size of an extracted single exe file is 150M. The application is a single windows form. Looks like: Show Please improve this issue the total of size and institute a spec of various release sizes as soon as possible, even I don’t have a deadline for it. Please make WPF great again.


A reference for contrast: stammel_go.dll

A go library built inside this project which size is about 2.5M including go framework. I know the size issue could not be resolved as just involving WPF, but it is an obvious spot if a real application builder would be encountering the same issue with the same feeling.

nsivov commented 4 years ago

According to this [1] two deployment modes exist, self contained and with shared runtime.

[1] https://docs.microsoft.com/en-us/dotnet/core/deploying/

AZ-X commented 4 years ago

According to this [1] two deployment modes exist, self contained and with shared runtime.

[1] https://docs.microsoft.com/en-us/dotnet/core/deploying/

@nsivov Thanks for the information.

fabiant3 commented 4 years ago

This is more of a dotnet issue, not particular to WPF.

AZ-X commented 4 years ago

This is more of a dotnet issue, not particular to WPF.

WPF libraries obviously increase the size.

AZ-X commented 3 years ago

I just built a new version on dotnet 5. The total size of it is half of previous one. Glad to see a great improvement. Please don't close this issue until the overall size of common WPF projects is in range with popular others lang.

https://github.com/AZ-X/WPF-GO-dnscrypt-proxy-md/releases/tag/latest https://github.com/AZ-X/pique A go project and size of its binary for Windows is close to 6M

dantewang commented 2 years ago

@AZ-X Was the smaller size achieved by enabling trimming? Unfortunately in .NET 6 WPF is marked as incompatible with trimming...

cyraid commented 2 years ago

Man, I miss the days where we weren't outlawed of using Delphi. Free Pascal + Lazarus will give you nice small executables but not as much information / support. Not many people like using Pascal though, now if there were an alternative of cross platform rapid development using say, C#? Count me in.

AZ-X commented 1 year ago

@AZ-X Was the smaller size achieved by enabling trimming? Unfortunately in .NET 6 WPF is marked as incompatible with trimming...

Well, I just tried dotnet 7 on the release day and it looks essential and ...

<TargetFramework>net7.0</TargetFramework>
<SelfContained>false</SelfContained>
<!--<PublishSingleFile>true</PublishSingleFile>-->
<PublishAot>true</PublishAot>

:rofl:

EtherGhost commented 1 year ago

Man, I miss the days where we weren't outlawed of using Delphi. Free Pascal + Lazarus will give you nice small executables but not as much information / support. Not many people like using Pascal though, now if there were an alternative of cross platform rapid development using say, C#? Count me in.

Have a look at Avalonia.UI!

cyraid commented 1 year ago

Man, I miss the days where we weren't outlawed of using Delphi. Free Pascal + Lazarus will give you nice small executables but not as much information / support. Not many people like using Pascal though, now if there were an alternative of cross platform rapid development using say, C#? Count me in.

Have a look at Avalonia.UI!

I've used it, and decided to stop using it. I'm not a fan of XML first development. I know there's an extension for VS to work with it, but there's sooooo many things you have to learn to just do something simple. Plus it doesn't have natural docking support, and there's a bug with styling (padding is being overridden and you can't override it), just too many issues.