views:

543

answers:

4

I´m working on a project, in Visual Studio 2008, which DLL currently surpasses 20 MB. Is there a way to profile that DLL, searching the main contributors to this size?

I suspect that breaking it in smaller projects inside the solution would help, but I'm looking for a faster solution (although not better, I'm afraid).

As a sidenote, we are getting 'unexpected error writing metadata' error, that we think it's related to the DLL size. However, when restarting Visual Studio 2008, the error vanishes. Until it appears later again, after a few rebuilds. The disk space is not a problem.

+6  A: 

Yowser! Have you perchance got some huge resx files (or other embedded content) that are getting embedded in the dll? Perhaps treat those as external content? I'd start by looking at the files in the project tree... that 20Mb has to come from somewhere obvious - large graphics, etc.

Marc Gravell
+1, agreed. Even the monstrously-huge Infragistics assemblies are 2 - 3 MB, tops. I'd be shocked if you didn't have some gargantuan resources -- images, sounds, some kind of large binary -- cluttering you up.
John Rudy
Oops. Found it. A bunch of reports (Crystal Reports) exceeding 1Mb each...
Seiti
I had a generated DAL assembly around 8-9mb once, thank goodness no more!
leppie
@Seiti - cool ;-p
Marc Gravell
A: 

Microsoft.SharePoint.dll is 9Mb. Even for a complex product like SharePoint, DLLs are separated into separate projects.

If you have a large project and that nothing is coming from the resources, might I suggest splitting your project into different assemblies?

I saw the exact error you had but on a VS2003 environment (which Microsoft showed on support.microsoft.com). However, since you are in VS2008, it might also be due to a disk space issue.

Did you verify that all the disks used by Visual Studio are not full/almost full?

Maxim
The disk is almost empty. Updating the question.
Seiti
+2  A: 

PE Explorer will show you the contents.

This may also help?

Update: Dependency Walker may also help here. You can run it in "Profile Mode" which works by executing your application and watching it to see what it loads.

nzpcmad
A: 

Oops! Found a bunch (50+) of huge report templates generated using Crystal Reports, each one around 1MB.

All we had to do was excluding them from project.

Seiti