473,320 Members | 2,048 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,320 software developers and data experts.

Explicitly load config settings from .NET assembly

Is there .NET framework code that I can call from an assembly (.dll), that
will load the settings of a configuration file into the .NET framework. For
example you can set up Switches and TraceListeners through config settings
such as:

<system.diagnostics>
<switches>
<add name="MySwitch" value="31" />
</switches>
<trace>
<listeners>
<add name="MyListener" type="Common.Listeners, Common" />
</listeners>
</trace>
</system.diagnostics>

but if I have code running as a Word addin there is no easy way to load them
through a config file because a Word addin does not have the usual
AppName.exe.config file that regular applications use.

Does anyone know how to do this?

Thanks in advance

Kevin

Nov 22 '05 #1
1 1996
The same naming convention and behavior works with unmanaged hosts as
well (although the host can choose to use a different config file when
creating your app domain). Try naming the config file
winword.exe.config and put it in the same folder as winword.exe. I'm
assuming that Winword.exe is the unmanaged host. To verify which
executable loads your managed code, try using ProcessExplorer from
SysInternals (www.sysinternals.com). It will highlight all processes
that are running managed code, which should help you identify the one
you want.

Joshua Flanagan
http://flimflan.com/blog

Kevin Lewis wrote:
Is there .NET framework code that I can call from an assembly (.dll), that
will load the settings of a configuration file into the .NET framework. For
example you can set up Switches and TraceListeners through config settings
such as:

<system.diagnostics>
<switches>
<add name="MySwitch" value="31" />
</switches>
<trace>
<listeners>
<add name="MyListener" type="Common.Listeners, Common" />
</listeners>
</trace>
</system.diagnostics>

but if I have code running as a Word addin there is no easy way to load them
through a config file because a Word addin does not have the usual
AppName.exe.config file that regular applications use.

Does anyone know how to do this?

Thanks in advance

Kevin

Nov 22 '05 #2

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

Similar topics

1
by: Kevin Lewis | last post by:
Is there .NET framework code that I can call from an assembly (.dll), that will load the settings of a configuration file into the .NET framework. For example you can set up Switches and...
13
by: Thom Little | last post by:
My first ASP.NET application on Visual Studio 2005 and .NET Framework 2.0 The application compiles and executes correctly on the development machine. I then publish it to an empty directory on...
4
by: Brian Richards | last post by:
Is it possible to run code in an assembly when it's loaded? In my case I have an assembly that requires that the users path be setup correctly or GetTypes() will throw an exception. Looking for a...
9
by: Dick | last post by:
Visual Studio saves lots of values in the project's app.config file (connection strings for datasets, My.settings, etc.), but as far as I can see, if the project is in the middle teir, these values...
2
by: Jeff | last post by:
Hey asp.net 2.0 My asp.net 2.0 project has got a assembly load problem: Some of my web.config settings: <membership defaultProvider="AH_MembershipProvider" userIsOnlineTimeWindow="15">
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
7
by: Artie | last post by:
Hi, Our team have a web project which includes some C# ActiveX DLLs. On some developers' PCs, the code which calls methods in the ActiveX dll is succesful - no exceptions. On other PCs, the...
10
by: =?Utf-8?B?TUNN?= | last post by:
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...
0
by: =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?= | last post by:
Thank U Sir, It works ::)) Now I have one more issue. I have downloaded Ajax frame work and in the toolbox I am getting AJAX Extention in which i find the Script manager. Bit,in the design...
2
by: David Thielen | last post by:
So we have moved our app from .NET version 2.X in IIS6 to a Windows 2008 Server running IIS7. We have copied all files to the Windwardreports\apps directory and that apps directory has been...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.