Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I've searched these forums and found lots of references to Option Strict, most of which say that you should turn this on for all projects. However, I can't find any way to turn this on by default. Is it possible and if so, how?

 

wyrd mentioned writing an add-in that automatically sets Option Strict to On and removes the Microsoft.VisualBasic import. I can't find any reference in the online help regarding add-ins - how would you go about doing this?

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted

I've already checked them (that's where I removed the references to the Microsoft.VisualBasic namespace) but Option Strict/Explicit isn't there.

 

I have been wondering whether you could do something with the scripts in the VBWizards folder but it's a little daunting to me.

 

What about the Add-in idea? Any sources of information on writing add-ins?

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

  • *Gurus*
Posted

I had a quick go, and I was able to do this. I opened the file:

 

\VS.NET\Vb7\VBWizards\WindowsApplication\Templates\1033\WindowsApplication.vbproj

 

And added the line:

 

OptionStrict = "On"

 

Just after the OutputType = "WinExe" line.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

Nice one. Not seeing Option Explicit there I figured it wasn't the correct place. I guess Option Explicit = "On" is a default anyway.

 

Thanks.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

  • *Experts*
Posted

On a side note, removing the reference to Microsoft.VisualBasic is

useless; it is required regardless, and will be referenced anyway.

 

Besides, they're not all bad anyway.

Posted
On a side note, removing the reference to Microsoft.VisualBasic is

useless; it is required regardless, and will be referenced anyway.

 

Besides, they're not all bad anyway.

Are you sure about that? It works on mine!

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

  • *Gurus*
Posted
You can remove the imports statement but you cannot remove the reference. The Visual Basic .NET compiler (vbc.exe) will add the reference regardless, whether a project is compiled from Visual Studio or from the command line. This shouldn't be a concern to anyone however, since the Microsoft.VisualBasic assembly is distributed as an integral part of the .NET Framework.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...