VB.NET Compiled Executable footprint in .Net 2.0

G

Guest

In converting my projects from VS2003 to VS2005, I've found that my compiled
components file size has grown considerably (on average, by about 38%!!).

Althought drives are cheap, bandwidth and Time is not!

Investigating the assemblies with ILDASM (comparing my v1.1 to my v2.0),
I've noticed that there are many objects that have been emitted to the
assemblies under the "MY" namespace.

I've found in MSDN that I can set a compiler option of
"/define_MYTYPE=/"Empty/" to prevent my assemblies from being littered with
the MY. objects, but I can't figure out how / where to set this compiler
option.

If anyone can give me an example of how to set this compiler option, it
would be greatly appreciated - (I'd love to move to 2005, but the cost of the
file sizes may negate the advantages of the new platform).

Thanks in advance,

Skip V.
 
H

Herfried K. Wagner [MVP]

SkipV said:
Investigating the assemblies with ILDASM (comparing my v1.1 to my v2.0),
I've noticed that there are many objects that have been emitted to the
assemblies under the "MY" namespace.

I've found in MSDN that I can set a compiler option of
"/define_MYTYPE=/"Empty/" to prevent my assemblies from being littered
with
the MY. objects, but I can't figure out how / where to set this compiler
option.

According to the documentation no 'define_mytype' compiler option exists
(<URL:http://msdn2.microsoft.com/en-us/library/w95cx9k1.aspx>). I was not
able to find any information about this option using Google and MSDN search
either. Thus I am really curious where in MSDN you found this option. I do
not think that there is such an option at all.
 
N

Neal Andrews

I too am interested in this. I found a reference to it's use in the example
for the nostdlib compiler option here:
http://msdn2.microsoft.com/en-us/library/79e7wdtc.aspx

You should be able to set the compiler options in the Compile Page of the
Project Designer (project properties). I cannot confirm this as I'm using
the useless VB Express version at the moment and it appears you can only get
VS05 if you have an MSDN sub.:-(

Regards
 
H

Herfried K. Wagner [MVP]

Neal Andrews said:
I too am interested in this. I found a reference to it's use in the example
for the nostdlib compiler option here:
http://msdn2.microsoft.com/en-us/library/79e7wdtc.aspx

That really seems to work when compiling from command line.
You should be able to set the compiler options in the Compile Page of the
Project Designer (project properties). I cannot confirm this as I'm using
the useless VB Express version at the moment and it appears you can only
get VS05 if you have an MSDN sub.:-(

Yes, at least in the August CTP there is an "Advanced Compile Options"
button there. Still do not have the final too, although I am an MSDN
subscriber.
 
D

dgk

That really seems to work when compiling from command line.


Yes, at least in the August CTP there is an "Advanced Compile Options"
button there. Still do not have the final too, although I am an MSDN
subscriber.

I have the standard edition and I don't see anything in the compile
options except Enable Optimizations (defaults to checked). There are
options to have pre and post build event command lines which might be
useful.
 
G

Guest

Here's the online link to the compiler option:
http://msdn2.microsoft.com/library/ms233781(en-US,VS.80).aspx

To navigate to it in your local MSDN (that installs with the IDE) go to :
MSDN2 Library > Development Tools and Languages > Visual Studio > Visual
Basic > Developing Applications with Visual Basic > Customizing Projects and
Extending My > Customizing Which Objects are Available in My
 
G

Guest

I should probably qualify my original file size growth concerns with:
The compiled components of the system I'm working on range in file size
(v1.1) from 7k to 160k. Small footprints are important to us because we
update roughly 3000 sites (retail stores) thru dial-up connections (during
the night).

Anyway, I believe that I've found how to resolve my problem:
To get the IDE to spit out the vbc.exe compiler option of _MyType =
/"Empty/", I was able to edit the .vbproj file and change the value in the
<MyType></MyType> attribute from "Windows" or "WindowsWithCustomSubMain" to
"Empty".

After compiling with that change to my project file, the My namespace is
nowhere to be found in my compiled assemblies (and most importantly, my file
size is back down to where I expected it to be).

From what I understand, I should be able to setup a Project Template with
this modification to the .vbproj file and have any newly created projects
default to this Empty setting (although, I haven't tried this yet).

I've also found (figured I'd try one more thing before I posted this), that
if I set the Project Designer's -> Compile -> Advanced Compile Options ->
Custom Constants to a value of: _MyType="Empty". This will cause the IDE to
spit out the standard _MyType="Windows" (or whatever) along with my override
of _MyType="Empty". This override, appears to work (eventhough both _MyType=
options exist on the Output windows command line); the compiled assembly
again does not contain the My namespace and my file sizes are the reduced
size.


Take Care,

Skip V.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top