How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1.
In my web.config I have:
<compilation debug="true" strict="true" />
In my Tools/Options/Projects and solutions/vb defaults I have option
strict on.
In my .vb file I have:
Dim NiceBug As Boolean = "Hello world"
which happily compiles. Not so happy at runtime though.
I'd appreciate some advice as to how I get option strict enabled in my
projects without having to add it to every file manually.
And what exactly do the options I've described above actually affect?use C#
Poldie wrote:
> How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1.
> In my web.config I have:
> <compilation debug="true" strict="true" />
> In my Tools/Options/Projects and solutions/vb defaults I have option
> strict on.
> In my .vb file I have:
> Dim NiceBug As Boolean = "Hello world"
> which happily compiles. Not so happy at runtime though.
> I'd appreciate some advice as to how I get option strict enabled in my
> projects without having to add it to every file manually.
> And what exactly do the options I've described above actually affect?
>
re:
!> I'd appreciate some advice as to how I get option strict enabled in my
!> projects without having to add it to every file manually.
change the default value of Option Strict for VB.NET, follow these steps:
Locate WebApplication.vbproj, inside:
drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\VisualBasic\Web\1033\_
WebApplicationProject.zip
Extract it, modify the Option Strict line so it's On, save the file
and add it back to the zip file, overwriting the original file.
Notice there's other files in the same zip file where the option must be set
, too.
Also, do the same for any file in:
drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\VisualBasic\Web
which has Option Strict = Off
I agree that the IDE is buggy regarding the setting of this option,
but there's a viable workaround, as detailed in this post.
btw, if you want to change the Option Strict option for other types of proje
cts
( Windows app, Windows Service, etc. ), you'll need to do the same for *thei
r* templates.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Poldie" <Poldie@.gmail.com> wrote in message
news:1182551547.381108.176690@.i13g2000prf.googlegroups.com...
> How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1.
> In my web.config I have:
> <compilation debug="true" strict="true" />
> In my Tools/Options/Projects and solutions/vb defaults I have option
> strict on.
> In my .vb file I have:
> Dim NiceBug As Boolean = "Hello world"
> which happily compiles. Not so happy at runtime though.
> I'd appreciate some advice as to how I get option strict enabled in my
> projects without having to add it to every file manually.
> And what exactly do the options I've described above actually affect?
>
On Jun 23, 12:44 am, "Juan T. Llibre" <nomailrepl...@.nowhere.com>
wrote:
> re:
> !> I'd appreciate some advice as to how I get option strict enabled in my
> !> projects without having to add it to every file manually.
> change the default value of Option Strict for VB.NET, follow these steps:
> Locate WebApplication.vbproj, inside:
> drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\VisualBasic\Web\103=
3\=ADWebApplicationProject.zip
> Extract it, modify the Option Strict line so it's On, save the file
> and add it back to the zip file, overwriting the original file.
> Notice there's other files in the same zip file where the option must be =
set, too.
> Also, do the same for any file in:
> drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\VisualBasic\Web
> which has Option Strict =3D Off
> I agree that the IDE is buggy regarding the setting of this option,
> but there's a viable workaround, as detailed in this post.
> btw, if you want to change the Option Strict option for other types of pr=
ojects
> ( Windows app, Windows Service, etc. ), you'll need to do the same for *t=
heir* templates.
I'll give that a go, although it sounds like something which might
come into effect when I next create a new project rather than change
my existing one.
As I explained above, I've already changed my entry in web.config and
in the menu, so if your solution works, where is it changing the
setting, and can I not set it myself manually?
Cheers,
Poldie.
"Poldie" <Poldie@.gmail.com> wrote in message
news:1182591579.578371.232160@.q75g2000hsh.googlegroups.com...
> As I explained above, I've already changed my entry in web.config and
> in the menu, so if your solution works, where is it changing the
> setting, and can I not set it myself manually?
Have you tried Tools, Options, Projects and Solutions, VB Defaults?
No idea if this will modify existing projects, though, as I never go
anywhere near VB.NET...
http://www.markrae.net
On Jun 23, 11:08 am, "Mark Rae" <m...@.markNOSPAMrae.net> wrote:
> "Poldie" <Pol...@.gmail.com> wrote in message
> news:1182591579.578371.232160@.q75g2000hsh.googlegroups.com...
>
> Have you tried Tools, Options, Projects and Solutions, VB Defaults?
> No idea if this will modify existing projects, though, as I never go
> anywhere near VB.NET...
Yeah, I believe I explained that in my first post. I also tried in
web.config. Neither had any effect - only adding a line of text to
each file manually.
re:
!> Have you tried Tools, Options, Projects and Solutions, VB Defaults?
!> No idea if this will modify existing projects, though, as I never go anyw
here near VB.NET...
It doesn't even change the setting for *new* projects, Mark.
re:
!> where is it changing the setting, and can I not set it myself manually?
There's no way to change the setting at design time, for new projects,
because the change is needed in the project *template*.
Devenv.exe creates a new project based on the existing templates,
and the default for that is option "strict= false".
Changing the option, in the template's web.config, is the only solution.
Btw, the directory location in my earlier post is either incorrect or was ch
anged by SP1.
Instead of :
drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\VisualBasic\Web\1033\_
WebApplicationProject.zip
The correct path is :
Drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\Web\VisualBasic\1033\W
ebApplication.zip
Extract web.config from that zip file, change <compilation debug="false" str
ict="false"
explicit="true" />
to <compilation debug="false" strict="true" explicit="true" />
and zip it up again, updating WebApplication.zip
That will automatically create/compile projects with that strict="true" conf
igured.
And, btw, that's not behavior "by design". It's a bug.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Mark Rae" <mark@.markNOSPAMrae.net> wrote in message news:ebABC6XtHHA.768@.TK2MSFTNGP04.phx.
gbl...
> "Poldie" <Poldie@.gmail.com> wrote in message
> news:1182591579.578371.232160@.q75g2000hsh.googlegroups.com...
>
> Have you tried Tools, Options, Projects and Solutions, VB Defaults?
> No idea if this will modify existing projects, though, as I never go anywh
ere near VB.NET...
>
> --
> http://www.markrae.net
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:el4Y1KatHHA.3356@.TK2MSFTNGP03.phx.gbl...
> re:
> !> Have you tried Tools, Options, Projects and Solutions, VB Defaults?
> !> No idea if this will modify existing projects, though, as I never go
> anywhere near VB.NET...
> It doesn't even change the setting for *new* projects, Mark.
Really...? Then what on earth does that setting do...?
> And, btw, that's not behavior "by design". It's a bug.
Thank God I use C#... :-)
http://www.markrae.net
re:
!> Ok pay attention! I've I explained earlier, I've already set my
!> web.config file, manually, with the appropriate text:
!> <compilation debug="true" strict="true" />
No. *You* pay attention. I've already explained it's a *bug*.
It's been fixed in VS 2005 SP1.
re:
!> It's not having any effect.
This isn't an ASP.NET bug. It's a VS 2005 bug.
Nothing you do, as far as ASP.NET configuration goes,
will affect the way VS 2005 compiles source files.
What you *can* do, and works, is install VS 2005 SP1.
*Then*, when you change Tools/Options/Projects and Solutions/VB Defaults to
option strict on, and you change the web.config to strict="true", and you ad
d to a .vb file :
Dim NiceBug As Boolean = "Hello world"
...you will see that the VS 2005 IDE flags it as an error,
and suggests you change the line to : Dim NiceBug As Boolean = CBool("Hello
world")
Never mind that the suggested change is bonkers, though. :-)
At least it flags the error as an error which will not compile correctly.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Poldie" <Poldie@.gmail.com> wrote in message
news:1182610151.805091.156980@.u2g2000hsc.googlegroups.com...
On Jun 23, 3:28 pm, "Juan T. Llibre" <nomailrepl...@.nowhere.com>
wrote:
> re:
> !> Have you tried Tools, Options, Projects and Solutions, VB Defaults?
> !> No idea if this will modify existing projects, though, as I never go an
ywhere near VB.NET...
> It doesn't even change the setting for *new* projects, Mark.
> re:
> !> where is it changing the setting, and can I not set it myself manually?
> There's no way to change the setting at design time, for new projects,
> because the change is needed in the project *template*.
> Devenv.exe creates a new project based on the existing templates,
> and the default for that is option "strict= false".
> Changing the option, in the template's web.config, is the only solution.
> Btw, the directory location in my earlier post is either incorrect or was
changed by SP1.
> Instead of :
> drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\VisualBasic\Web\1033
\_WebApplicationProject.zip
> The correct path is :
> Drive:\VStudioInstallDir\Common7\IDE\Pro
jectTemplates\Web\VisualBasic\1033
\WebApplication.zip
> Extract web.config from that zip file, change <compilation debug="false" s
trict="false"
> explicit="true" />
> to <compilation debug="false" strict="true" explicit="true" />
> and zip it up again, updating WebApplication.zip
> That will automatically create/compile projects with that strict="true" configured
.
Ok pay attention! I've I explained earlier, I've already set my
web.config file, manually, with the appropriate text:
<compilation debug="true" strict="true" />
It's not having any effect. Therefore fiddling in zip files is going
to have the same effect next time I create a new project - no effect
whatsoever. The only thing which makes a difference is setting the
option at the top of each page. I appreciate that this isn't a
problem in c#, but this doesn't help me as I'm not developing in c#.
On Jun 23, 4:52 pm, "Juan T. Llibre" <nomailrepl...@.nowhere.com>
wrote:
> re:
> !> Ok pay attention! I've I explained earlier, I've already set my
> !> web.config file, manually, with the appropriate text:
> !> <compilation debug="true" strict="true" />
> No. *You* pay attention. I've already explained it's a *bug*.
> It's been fixed in VS 2005 SP1.
I've got SP1. At least, I installed it. Of course, Microsoft being
Microsoft, they don't bother to put "SP1" on the Help screen so I can
confirm this. I definitely sat around for over an hour waiting for
the service pack to do somthing, a few months ago. Perhaps it failed
silently though. Wouldn't surprise me.
> This isn't an ASP.NET bug. It's a VS 2005 bug.
I can believe this.
> Nothing you do, as far as ASP.NET configuration goes,
> will affect the way VS 2005 compiles source files.
> What you *can* do, and works, is install VS 2005 SP1.
> *Then*, when you change Tools/Options/Projects and Solutions/VB Defaults t
o
> option strict on, and you change the web.config to strict="true", and you
add to a .vb file :
> Dim NiceBug As Boolean = "Hello world"
> ...you will see that the VS 2005 IDE flags it as an error,
> and suggests you change the line to : Dim NiceBug As Boolean = CBool("Hello world"
)
Well, no, it won't.
> Never mind that the suggested change is bonkers, though. :-)
> At least it flags the error as an error which will not compile correctly.
That'll do me! I'm going to fiddle with the zip files in just a few
moments (after I've confirmed SP1 installed properly on my machine)
and see what happens. I guess I'll have to create a new project and
create new pages and cut and paste my code into them to take advantage
of the newly enabled status of `option strict`, right?
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment