Did you know… How to optimize your code for a build? - #290

in yesterday’s tip, i explained what is and isn’t your code.

One of the ways to make your code not yours (okay, it’s technically non-user code, i’m having way too much fun on this play on words) is to optimize it.

For C#, go to the Project Properties – Build page.

Optimize code option for C#

For VB, go to the Project Properties – Compile. At the bottom of the page, there’s the “advanced compile options” button. Pressing this button will show you the option to optimize your code.

Optimize code option for VB

Once again, I get the luxury of having the “email the developer” feature whenever an option doesn’t work for me.  After 20 minutes of trying to figure out why my code was still acting like my code, I emailed the developer, and found out that you need to make sure one checkbox is unchecked.

Under Tools – Options – Debugging – General, there’s the Suppress JIT optimization on module load (Managed only)

Suppress JIT optimization on module load

With the optimized code option checked and the Suppress JIT optimization on module load unchecked, you’ll see the ClassLibrary1 (from yesterday’s example) now optimized and no longer your code (non-user code)

ClassLibrary1 in Modules window

Technorati Tags: VS2005Tip,VS2008Tip