Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My compiled app generates 624 files, 52 folders, and consumes 170mb of hard drive space. That's freakin ridiculous.

How SPECIFICALLY do I trim that down to something more reasonable?

What I have tried:

I tried looking for specific instructions on the net and found NOTHING that helped.
Posted
Updated 17-Feb-21 23:19pm
v2

If you're targeting a specific platform, maybe this helps:

Quote:
.NET 5 provides a common set of APIs that aligns the different runtime implementations. This set of APIs is identified by the net5.0 Target Framework Moniker (TFM), which is the token you set in your .NET project to specify the target framework. This enables your application to run on any runtime implementation supporting .NET 5. However, you can still build applications for a specific platform. For example, to build an application that uses Windows API, you need to specify the net5.0-windows TFM. This way, building a platform-specific application is your choice, not a choice depending on the runtime implementation you are using to develop your application.
 
Share this answer
 
Comments
#realJSOP 18-Feb-21 4:41am    
It's already set to that.
In addition to Gerry's advice, there is also a trimming option when building, see:
how-to-reduce-net-core-app-size[^]
 
Share this answer
 
Comments
#realJSOP 18-Feb-21 4:43am    
I already tried that and it didn't appear to have any effect
I found out why it was doing that. I needed access to InstalledFontCollection, which is accessed with a reference to System.Drawing (the System.Drawing.Text namespace).

When I converted the app to .Net 5, I added the NuGet package Microsoft.Windows.Compatibility, which adds the 600+ files to the compiled project, and there's apparently no (easy or reasonable) way to relieve yourself of that payload.

WTF was Microsoft thinking?
 
Share this answer
 
Comments
RickZeeland 18-Feb-21 5:24am    
Don't forget to mark your solution as answer :)
Richard Deeming 18-Feb-21 5:40am    
Couldn't you just reference the System.Drawing.Common package directly?
NuGet Gallery | System.Drawing.Common 5.0.1[^]
#realJSOP 18-Feb-21 5:47am    
I just did that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900