Why VS2005.IDE adds app.config to C# Class Library projects?

M

Maxwell2006

Hi,

As far as I know, a class library project cannot have any app.config
dedicated to itself and it always depends on the main application to provide
the .config settings.

Based on above, I am confused when I see that VS2005 adds an app.config file
upon I add a web service to my dll class library and stores the URL address
to the asmx file within that app.config file. Obviously that app.config file
is useless. Do I miss any best practices or this is a problem within visual
studio 2005 IDE?

Thank you,
Max
 
M

Michael Nemtsev

Hello Maxwell2006,

M> As far as I know, a class library project cannot have any app.config
M> dedicated to itself and it always depends on the main application to
M> provide the .config settings.

yep, but you can use Xml to open file manually and use it

M> Based on above, I am confused when I see that VS2005 adds an
M> app.config file upon I add a web service to my dll class library and
M> stores the URL address to the asmx file within that app.config file.
M> Obviously that app.config file is useless. Do I miss any best
M> practices or this is a problem within visual studio 2005 IDE?

AFAIK, in this case App.config is not used at all, at least it works fine
where I met this

---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
K

Kevin Yu [MSFT]

Hi Max,

The IDE adds an app.config file to the class library project to store the
URL for the web service in this case. When compiling the project, this URL
in the app.config file will be made as the default URL for the web service.

When you have a, for example, windows form app calling the class library,
and the web service has been moved. You can add the same key in the winform
app.config file, and the class library will then use the new URL instead of
the default one.

If anything is unclear, please feel free to let me know.

Kevin Yu
Microsoft Online Community Support

==================================================
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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top