Windows Phone Developers

Sunday, April 27, 2008

Change the default values of Option Explicit and Option Strict in .NET

Change the Default Project Values in .NET

You can change the default values of Option Explicit and Option Strict on a per project type basis. For example, when you create a new Visual Basic .NET or Visual Basic 2005 application, the value for Option Explicit is set to On. You can change this default value to Off.

To change the default values of Option Explicit and Option Strict, follow these steps:

  1. Locate the following project template files on your system:
    • EmptyProjectIPF.vbproj
    • EmptyWebProjectIPF.vbproj
    • WebApplication.vbproj
    • WebControl.vbproj
    • WebService.vbproj
    • WindowsApplication.vbproj
    • WindowsControl.vbproj
    • WindowsService.vbproj
  2. Open a project template in Notepad.
  3. Add (or edit if they are already present) the OptionStrict and OptionExplicit lines in the section of the template.

    For example, the following code demonstrates how to set OptionExplicit to Off and OptionStrict to On:

OutputType = "Exe"

StartupObject = ""

OptionExplicit = "Off"

OptionStrict = "On"

>

  1. Repeat steps 2 and 3 for each project template that you want to change the default behavior for.
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment