Question

I'm trying to reduce as much as I can my VB.Net assembly side, and I just figured out that all variable names were kept unchanged in the actual assembly. Since I tend to use pretty long var names, it adds up and, by running dotfuscator on my assembly, I could shrink it by as much as 10%.

Thus I wonder: is there any way to tell Visual Studio to use shorter var names in the generated assembly? Are there any downsides to using dotfuscator (I'd rated avoid it though, since it'd need to be called after every compilation, therefore forcing me to update my build scripts...)?

Thanks a lot, CFP.

Was it helpful?

Solution

No. It's actually not safe to change names without any guidance. Renaming can break code, especially if you're using Reflection.

Visual Studio always goes for safety. If you want to re-name your variables, you could add obfuscation to the build scripts to have them automatically redone each build.

That being said, once the assembly is compiled at runtime by the JIT, it won't matter. The only advantages of obfuscating and using shorter names are a slightly smaller assembly, which may (slightly) improve your load times, but shouldn't matter much for runtime.

OTHER TIPS

You could buy a .NET Obsfucator that does compression:

http://www.xenocode.com/Obfuscator/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top