web.config vs. My Project

  • Thread starter Thread starter MCM
  • Start date Start date
M

MCM

When creating a new VB Web Application Project with VS2008, there are several
settings (compiler settings, option strict, etc) that appear both in the
web.config file and "My Project". I'm wondering what takes precedent, what
the benefit of using one vs. the other is, and what happens if they conflict?
 
"My Project" is meant to be the way to set your preferences, rather than
going into configuration files and editing them manually. You shouldn't
ever have to go into web.config to set option strict because you can do it
in the My Project dialgogs.

I don't think you can have a conflict because for things that are in
web.config and My Project, changing the setting in one will cause it to
change in the other.
 
That is incorrect. I agree that My Project is meant to be a method of editing
config files, but not web.config. Check for yourself. Perhaps it edits
app.config? That would make sense.
 
No, I'm sorry, but you are incorrect.

Perhaps you misunderstood what I said. I didn't say that we should never
have to edit web.config directly. My comments were about your particular
Option Strict, etc. settings. You should never have to go into web.config
to turn Option Strict (and various other settings) on or off, that is what
My Project dialogs are for and if you change it in one, it will be refelcted
in the other.

-Scott
 
I have litterally seen otherwise. I am looking at my code right now. I turn
option strict on in one, and it is NOT reflected in the other.
 
Have you tried changing Option Stict in the designer withOUT web.config open
in the editor and then opened web.config AFTER you've saved the designer
dialog?
 
Yes. It does not change web.config.

Scott M. said:
Have you tried changing Option Stict in the designer withOUT web.config open
in the editor and then opened web.config AFTER you've saved the designer
dialog?
 
Hi MCM,

As for the compile options in "project properties" and web.config
<compilation> element, they are actually different. To clarify the
difference and how each of them will affect ASP.NET Web application
project's output, it may require us to first go through the difference
between "Web Application project" and the default "Web Site project" of
ASP.NET 2.0 Web application.

In ASP.NET 2.0, it by default use dynamic compilation, which means it
doesn't generate precompiled assemblies in bin dir(like ASP.NET 1.1 /VS
2003). And that's just what you'll get when you create ASP.NET 2.0 web
project via the "Web Site project" model. Later, the ASP.NET team add a
new project model "Web Application project", this provide an ASP.NET 1.1/VS
2003 like model, at development time in IDE, you will be able to
build/compile the website and get precompiled assembly in "bin" dir.
However, the precompile only compile those codebehind classes or component
classes(such as those ones in app_code dir) into assemblies, for aspx or
ascx template, it still require dynamic compile at runtime. Here is a blog
entry that also mentioned some information on this:

#ASP.NET 2.0 - Web Site vs Web Application project
http://blogs.microsoft.co.il/blogs/maordavid/archive/2007/06/03/ASP.NET-2.0-
_2D00_-Web-Site-vs-Web-Application-project.aspx

Now, let's turn to the difference of the two compilation settings you have
seen:

1. the compilation settings/options in "My project" settings, that one is
used for the precompiling you performed via the build menu in visual
studio, which will affect the generated assembly in bin dir(just like other
non-asp.net projects such as winform, console...)

2. the compilation settings in web.config <compilation> element. This
setting control the compilation options/behaviors of the ASP.NET runtime
dynamic compilation (such as those aspx and ascx template which require
being compiled at runtime when they're accessed first time).

Here are some other articles mentioned some useful information related to
the ASP.NET 2.0 dynamic compilation model and something that coupled with
the visual studio IDE:

#Understanding ASP.NET Dynamic Compilation
http://msdn.microsoft.com/en-us/library/ms366723.aspx

#Debug and Release Builds in ASP.NET 2.0
http://odetocode.com/blogs/scott/archive/2005/11/15/2464.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.





--------------------
From: =?Utf-8?B?TUNN?= <[email protected]>
 
Very helpful. Thank you for the explanation.

Steven Cheng said:
Hi MCM,

As for the compile options in "project properties" and web.config
<compilation> element, they are actually different. To clarify the
difference and how each of them will affect ASP.NET Web application
project's output, it may require us to first go through the difference
between "Web Application project" and the default "Web Site project" of
ASP.NET 2.0 Web application.

In ASP.NET 2.0, it by default use dynamic compilation, which means it
doesn't generate precompiled assemblies in bin dir(like ASP.NET 1.1 /VS
2003). And that's just what you'll get when you create ASP.NET 2.0 web
project via the "Web Site project" model. Later, the ASP.NET team add a
new project model "Web Application project", this provide an ASP.NET 1.1/VS
2003 like model, at development time in IDE, you will be able to
build/compile the website and get precompiled assembly in "bin" dir.
However, the precompile only compile those codebehind classes or component
classes(such as those ones in app_code dir) into assemblies, for aspx or
ascx template, it still require dynamic compile at runtime. Here is a blog
entry that also mentioned some information on this:

#ASP.NET 2.0 - Web Site vs Web Application project
http://blogs.microsoft.co.il/blogs/maordavid/archive/2007/06/03/ASP.NET-2.0-
_2D00_-Web-Site-vs-Web-Application-project.aspx

Now, let's turn to the difference of the two compilation settings you have
seen:

1. the compilation settings/options in "My project" settings, that one is
used for the precompiling you performed via the build menu in visual
studio, which will affect the generated assembly in bin dir(just like other
non-asp.net projects such as winform, console...)

2. the compilation settings in web.config <compilation> element. This
setting control the compilation options/behaviors of the ASP.NET runtime
dynamic compilation (such as those aspx and ascx template which require
being compiled at runtime when they're accessed first time).

Here are some other articles mentioned some useful information related to
the ASP.NET 2.0 dynamic compilation model and something that coupled with
the visual studio IDE:

#Understanding ASP.NET Dynamic Compilation
http://msdn.microsoft.com/en-us/library/ms366723.aspx

#Debug and Release Builds in ASP.NET 2.0
http://odetocode.com/blogs/scott/archive/2005/11/15/2464.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
You're welcome.

If there is anything else we can help, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: =?Utf-8?B?TUNN?= <[email protected]> @TK2MSFTNGHUB02.phx.gbl>
Subject: Re: web.config vs. My Project
Date: Mon, 16 Jun 2008 07:08:10 -0700
 
Back
Top