Does removing a reference to a namespace shrink file size?

p_nivalis

Active member
Joined
Oct 1, 2004
Messages
33
Programming Experience
5-10
I was just wondering, if i were to for example, remove the microsoct.visualbasic namespace from the Imported namespaces, will the compiled program be smaller?
 
All importing a namespace does is force you to qualify its members with the name of the namespace in code. That would mean that you'd have to use 'Microsoft.VisualBasic.MsgBox' instead of just 'MsgBox'. That has no effect whatsoever on the compiled code.

You can't remove the reference to the Microsoft.VisualBasic.dll assembly. The IDE won't let you because VB.NET can't work without it. Even if you could, it wouldn't make any difference to the size of your assembly.
 
You should be able to remove Microsoft.VisualBasic. All it does is give you the ability to use legacy VB code in a .NET app right?

We talked about this a bit in the coding standards thread, I've found it a good thing to have dev's remove as they wont betempted to use Mid and such.
 
Raven... no that's the Microsoft.Compatibility.VB namespace that does that.... or something to that effect it might be Microsoft.VB.Compatibility... but I'm positive it's got Compatibility in it.... but I've been known to be wrong before.

-tg
 
Tg is spot on here. You can't remove the reference to Microsoft.VisualBasic.dll because VB.Net won't compile without it. Thing is not all VB.Net code can produce MSIL so it needs the runtime helpers that are stored in the aforementioned .dll. It's a shame i know, but thats the way it is.
 
Sorry, I was thinking namespaces. The namespace is listed as Microsoft.VisualBasic, but as TG and Vis clarified, the Reference can't be removed.

You can remove the namespace to promote less 6.0 coding at least.
 
Back
Top