Export (0) Print
Expand All


Enables or disables compiler optimizations.

/optimize[ + | - ]


+ | -
/optimize- disables compiler optimizations. /optimize+ enables optimizations. By default, optimizations are disabled.


Compiler optimizations make your output file smaller, faster, and more efficient. However, because optimizations result in code rearrangement in the output file, /optimize+ can make debugging difficult.

All modules used by an assembly must have been built using the same /optimize settings as the assembly's /optimize setting.

You can combine the /optimize and /debug options.

To set /baseaddress in the Visual Studio integrated development environment

  1. Open the project's Property Pages dialog box. For details, see <Projectname> Property Pages Dialog Box.
  2. Click the Configuration Properties folder.
  3. Click the Optimizations property page.
  4. Modify the Enable optimizations property.

To set /optimize programmatically

  • See Optimize Property.


The following code compiles t2.vb and enables compiler optimizations:

vbc t2.vb /optimize

See Also

Visual Basic Compiler Options | /debug | Sample Compilation Command Lines

© 2014 Microsoft