PC Review


Reply
Thread Tools Rate Thread

Configuration files in a shared add-in component

 
 
=?Utf-8?B?UVQ=?=
Guest
Posts: n/a
 
      13th Jul 2004
Hi.

Is it possible to use configuration files with a shared add-in component? I have added one to my solution for the add-in, but I can't pick up the values from my config file.

If my component's name is MyComponent.dll, my config file is named MyComponent.config.

Here is the file contents:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<addkey="data source" value="MyServer\MyShare" />
<addkey="initial catalog" value="MyDB" />
<addkey="security" value="false" />
<addkey="userid" value="myuserid" />
<addkey="password" value="mypassword" />
</appSettings>
</configuration>

Here is the code I've tried from a customized class object method within my component:
strDatasrc = System.Configuration.ConfigurationSettings.AppSettings("data source")
strInitcatalog = System.Configuration.ConfigurationSettings.AppSettings("initial catalog")
strSecurity = ConfigurationSettings.AppSettings("mysection/security")
strUserid = ConfigurationSettings.AppSettings("userid")
strPassword = ConfigurationSettings.AppSettings("password")

The values of my string variables stay as "Nothing".

I also tried using configuration sections, but no luck with that either.
--
Thanks!
QT
 
Reply With Quote
 
 
 
 
Telmo Sampaio
Guest
Posts: n/a
 
      13th Jul 2004
QT,

config files are create per application domain (executable). Therefore, you
will not be able to use it as you are trying to. I did some quick research
and I found an article showing how to create a class that you can use to
overcome this limitation. I have not tested it.

http://www.theserverside.net/develop...hread_id=25076

Telmo Sampaio
"QT" <(E-Mail Removed)> wrote in message
news:B42A0EFA-12CE-45B9-895F-(E-Mail Removed)...
> Hi.
>
> Is it possible to use configuration files with a shared add-in component?

I have added one to my solution for the add-in, but I can't pick up the
values from my config file.
>
> If my component's name is MyComponent.dll, my config file is named

MyComponent.config.
>
> Here is the file contents:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <appSettings>
> <addkey="data source" value="MyServer\MyShare" />
> <addkey="initial catalog" value="MyDB" />
> <addkey="security" value="false" />
> <addkey="userid" value="myuserid" />
> <addkey="password" value="mypassword" />
> </appSettings>
> </configuration>
>
> Here is the code I've tried from a customized class object method within

my component:
> strDatasrc = System.Configuration.ConfigurationSettings.AppSettings("data

source")
> strInitcatalog =

System.Configuration.ConfigurationSettings.AppSettings("initial catalog")
> strSecurity = ConfigurationSettings.AppSettings("mysection/security")
> strUserid = ConfigurationSettings.AppSettings("userid")
> strPassword = ConfigurationSettings.AppSettings("password")
>
> The values of my string variables stay as "Nothing".
>
> I also tried using configuration sections, but no luck with that either.
> --
> Thanks!
> QT



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Target designer cant stray from certain component configuration =?Utf-8?B?TWF0dCBTYW1ldA==?= Windows XP Embedded 7 14th Jun 2006 10:27 AM
Enhanced Write Filter component in your configuration =?Utf-8?B?YmVsYXlvbg==?= Windows XP Embedded 1 3rd Aug 2005 09:58 PM
error 1109: component: 'session manager requires an additional enabled component not in the current configuration msnews.microsoft.com Windows XP Customization 1 14th May 2004 05:23 PM
error 1109: component: 'session manager requires an additional enabled component not in the current configuration msnews.microsoft.com Windows XP Basics 1 14th May 2004 05:23 PM
error 1109: component: 'session manager requires an additional enabled component not in the current configuration msnews.microsoft.com Windows XP Embedded 1 14th May 2004 05:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:37 AM.