473,388 Members | 1,382 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

using an app.config of a referenced project

TS
I cannot get this to work. I added an app.config to a project i reference
from my web application project (vs 05) but can see no way to access the
settings within it.

the other thing is that I expected this config file (.dll.config) to get put
in my web app's bin folder along with it's .dll file when i did a build, and
that didnt' happen either.

do I have access to the app.config in my project or is it worthless? If so
why can i add an app.config?

thanks
Jun 15 '07 #1
6 4726
Hi TS,

From your description, you're using some class library projects in a Visual
studio 2005 solution and want to define some data/values in class library's
app.config file so as to reuse them in any upper level application which
reference the class library, correct?

Based on my understanding, for app.config file, .net framework application
only support using app.config file at application level at runtime. In
other words, only an application(exe) can use app.config file, for class
library component(dll), the app.config it reference is the one of the
application which load that class library assemblies. (So there is no
dedicated configuration file for assemby/dll at runtime).

However, why does VS 2005 allow us to add "app.config" file in class
library project? This is due to the following purpose:

In original class library(vs.net 2003), you can not define some values that
be shared with calling application and be able to overwrite/customize them.
Now, you can create setting items in the VS 2005 class library's project
"Settings" collection. To add/manage settings, you go through the following
steps:

**open project properties dialog

**choose "settings" tab in left

** in right panel, you can add multiple settings items(of various type)

After you add items and save it, you can find that the setting items are
actually saved/persisted in the app.config file in the class library
project.

Thus, when you reference this class library in any other application
project, the settings of the project(default value) will be automatically
available, and if you want to override/customize these settings in the
calling application project, you will need to copy the XML configuration
fragment in class library's app.config to your calling application's
app.config (and modify the certain value you want to customize) e.g.

#this is a typical setting persistent content in class library app.config,
you can copy them to calling application's app.config file and customize
any item's value
==============
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGrou p, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ClassLibrary1.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/>
</sectionGroup>
</configSections>
<applicationSettings>
<ClassLibrary1.Properties.Settings>
<setting name="ClassLibrarySetting1" serializeAs="String">
<value>setting1 value</value>
</setting>
<setting name="ClassLibrarySetting2" serializeAs="String">
<value>setting2 value</value>
</setting>
</ClassLibrary1.Properties.Settings>
</applicationSettings>
===============================

For your scenario, you can consider define the values you want to share to
calling application in class library's settings collecction. Also, by
default "Settings" collection is marked as "internal", you can manually
change the accessor from "internal" to "public" in the code file so that
calling application can directly acccess them. e.g.

string value1=
ClassLibrary1.Properties.Settings.Default.ClassLib rarySetting1;

Here is a former thread also discussing on the similar question:

http://groups.google.com/group/micro...rk.webservices
/browse_thread/thread/c81a49ae2398f7b8/2f734c0f0d010cd1

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.

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

Jun 18 '07 #2
Hi TS,

Have you got any further idea on this thread or does the suggestion in my
last reply helps you some? If there is anything else we can help, please
feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 20 '07 #3
TS
looking into your recommendation, i found the following URL that is supposed
to explain this:
http://msdn.microsoft.com/library/de...tingsCS_RL.asp

unfortunately msdn server can't find this anymore. can you give me the
updated link?

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:fp**************@TK2MSFTNGHUB02.phx.gbl...
Hi TS,

Have you got any further idea on this thread or does the suggestion in my
last reply helps you some? If there is anything else we can help, please
feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>

Jun 20 '07 #4
Thanks for your reply TS,

For the broken reference link, it actually point to the MSDN docuemnt on
the .NET 2.0/VS 2005 project's Application Settings. However, it still
doesn't include description on how to share the settings/properties in
class library project to the host application that reference the class
librarry asembly.

#Application Settings
http://msdn2.microsoft.com/en-us/lib...xh(VS.80).aspx

#Application Settings Overview
http://msdn2.microsoft.com/en-us/library/k4s6c3a0.aspx

My last reply and the messages in those former threads have described this.

If you have any further questions on this or any paricular things unclear,
please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.



Jun 21 '07 #5
TS
thanks

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:9m**************@TK2MSFTNGHUB02.phx.gbl...
Thanks for your reply TS,

For the broken reference link, it actually point to the MSDN docuemnt on
the .NET 2.0/VS 2005 project's Application Settings. However, it still
doesn't include description on how to share the settings/properties in
class library project to the host application that reference the class
librarry asembly.

#Application Settings
http://msdn2.microsoft.com/en-us/lib...xh(VS.80).aspx

#Application Settings Overview
http://msdn2.microsoft.com/en-us/library/k4s6c3a0.aspx

My last reply and the messages in those former threads have described
this.
>
If you have any further questions on this or any paricular things unclear,
please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
>




Jun 21 '07 #6
Please feel free to let me know if you have anything else wonder on the
related configuration or management approach.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 22 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Mark Broadbent | last post by:
Hi guys, just going through remoting at the moment and a couple of questions relating to .net in general has surfaced. Firstly I have seen in the designer that for the namespace and many of its...
4
by: Ed_P. | last post by:
Hello, I have the following scenario: I have a solution with 4 projects Project1 = MainWindow (Windows EXE) Project2 = PresentationLayer (DLL) Project3 = BusinessLayer (DLL) Project4 =...
5
by: WFB | last post by:
Hi, I have an application with a couple of referenced assemblies. The referenced assemblies and my application all share a few configuration settings with the same name but different values. ...
2
by: WFB | last post by:
Hi I have an application with a couple of referenced assemblies. The referenced assemblies and my application all share a few configuration settings with the same name but different values. Is...
4
by: Big Dave | last post by:
Good morning. I have a solution set up with multiple projects. One is a web project and it contains my web.config file. I would like to build a class within another project (a class library)...
1
by: David Williams | last post by:
Has the Schema of the Web.Config changed in Web App Projects? After converting my 2005 Web Site project to a 2005 WAP, and switching to IIS Web Server, I am getting a number of errors at run time...
8
by: Robert Dufour | last post by:
I have a winforms project Vs2005 with one project - Project1 which is the startup project and clsProject2 which is a class that is being used by Project1 (an exception handler). In clsProject2 I...
3
by: Jeff | last post by:
I have a solution with two projects. Project A is the startup project, while Project B serves as the project with the data logic. At run time, the first thing I need to do is write to Project...
7
by: eschneider | last post by:
I have a webservice which every time I build it keeps adding Crystal references into the web.config? <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.