473,597 Members | 2,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Configuration / Settings File

Is it possible to use a Settings / Configuration file in VS 2005 / .Net 2.0
in a dll? Or is this feature limited to an executable?

We have some .dlls where a configuration file would be helpful for things
such as Database Connection and other aspects. But when we use this file and
try to access it using Properties.Sett ings.Default... .., we get an object
error.

If this is possible: what are we doing wrong?
Dec 28 '05 #1
4 1638
Hi,

"Andy" <An**@discussio ns.microsoft.co m> wrote in message
news:2A******** *************** ***********@mic rosoft.com...
Is it possible to use a Settings / Configuration file in VS 2005 / .Net
2.0
in a dll? Or is this feature limited to an executable?
A config is intended to be used with an application, an exe in other words,
there is no a config file for a DLL
We have some .dlls where a configuration file would be helpful for things
such as Database Connection and other aspects. But when we use this file
and
try to access it using Properties.Sett ings.Default... .., we get an object
error.
You can either implement your own configuration utility (which is very
easy ) or include the values in the app configuration file
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
If this is possible: what are we doing wrong?

Dec 28 '05 #2
Would using the Machine.Config file work for universal things such as a
database connection?

"Andy" wrote:
Is it possible to use a Settings / Configuration file in VS 2005 / .Net 2.0
in a dll? Or is this feature limited to an executable?

We have some .dlls where a configuration file would be helpful for things
such as Database Connection and other aspects. But when we use this file and
try to access it using Properties.Sett ings.Default... .., we get an object
error.

If this is possible: what are we doing wrong?

Dec 28 '05 #3
You can also design an constructor which takes a configuration file.
When the object is initialized with this constructor, you can set up
all the properties.

HTH

Andy wrote:
Would using the Machine.Config file work for universal things such as a
database connection?

"Andy" wrote:

Is it possible to use a Settings / Configuration file in VS 2005 / .Net 2.0
in a dll? Or is this feature limited to an executable?

We have some .dlls where a configuration file would be helpful for things
such as Database Connection and other aspects. But when we use this file and
try to access it using Properties.Sett ings.Default... .., we get an object
error.

If this is possible: what are we doing wrong?

Dec 28 '05 #4
John:

Thank you for this information. But of course I have some questions if you
would be so kind.

Would I simply add a normal "settings / configuration" file to the .dll like
I would to an .exe? But how would I make the constructor take this
configuration file? Would you happen to have a link that would demonstrate
this, as I understand the concept, but not sure how to implement it as this
sounds like a very definiate solution to our problem.

"John Sun" wrote:
You can also design an constructor which takes a configuration file.
When the object is initialized with this constructor, you can set up
all the properties.

HTH

Andy wrote:
Would using the Machine.Config file work for universal things such as a
database connection?

"Andy" wrote:

Is it possible to use a Settings / Configuration file in VS 2005 / .Net 2.0
in a dll? Or is this feature limited to an executable?

We have some .dlls where a configuration file would be helpful for things
such as Database Connection and other aspects. But when we use this file and
try to access it using Properties.Sett ings.Default... .., we get an object
error.

If this is possible: what are we doing wrong?

Dec 29 '05 #5

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

Similar topics

1
2751
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks like: ================================================ <?xml version="1.0" encoding="utf-8" ?>
3
2878
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with applications and web services without having to use the machine.config file. I know that I could use the code below to do this but the problem then becomes that when using a shared assembly both the assembly and the config file need to be put...
7
5978
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include are like a root directory for a target program on the user's machine my app uses, which they would be prompted to supply at startup. Normally the registry is used for this but I'd rather not use the registry if possible. Isn't there some kind of...
7
22480
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We added an entry to the executable's .exe.config file to specify the URL, and under the 1.1 framework this worked well. Unfortunately, this is not working under the 2.0 framework. I see in the Reference.cs file under the web service reference the...
5
4584
by: Water Cooler v2 | last post by:
I know that we can add a single name value entry in app.config or web.config in the configuration/configSettings/appSettings section like so: <add key="key" value="value" /> Question: I want to add a dictionary of name-value pairs. In other words, instead of a single name-value, I want to add a name-value collection in there. I could do this:
5
2928
by: Hardy Wang | last post by:
Hi all, I understand, in .Net 2.0 we have little bit different model to read config file from .Net 1.1. Basically I need to use WebConfigurationManager.AppSettings to read from web.config, and ConfigurationManager.AppSettings to read from Windows Application config. Here is my question, I have a class library project which will be referenced by both Web and Windows Application in different projects, I need to read config setting inside...
5
1864
by: Allan Ebdrup | last post by:
I have a webservice in ASP.Net 2.0, I need to store and load a xml configuration file in relation to one of the web methods in my webservice. What's the best place to store and the best way to load my xml configuration file? I can't integrate the settings in web.config, it has to be a seperate file. Kind Regards, Allan Ebdrup
4
57051
by: aSoundMind | last post by:
Hi there, I recieve this error Server Error in '/integrate' Application. -------------------------------------------------------------------------------- Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
2
3614
by: Jan Eliasen | last post by:
Hi I am having some problems reading configuration values from a configuration file, using C# 2.0. I have programmed a Windows Service, and this part goes well - it runs nicely. Now, the Windows Service must call a Web Service every now and then. I have added the web reference, and made it dynamic, so I can change the
2
2775
by: remya1000 | last post by:
i'm using VB.NET 2003. Last time while i did a program in Vb.Net 2005, i use "Configuration". and i could read and write to that XML configuration file like the example below. CODES: Imports System.Configuration Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
0
7969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7886
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3886
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1238
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.