473,792 Members | 3,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.diagnos tics>
<switches>
<add name="MySwitch" value="31" />
</switches>
<trace>
<listeners>
<add name="MyListene r" type="Common.Li steners, Common" />
</listeners>
</trace>
</system.diagnost ics>

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.con fig file that regular applications use.

Does anyone know how to do this?

Thanks in advance

Kevin

Nov 22 '05 #1
1 2022
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.con fig 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.diagnos tics>
<switches>
<add name="MySwitch" value="31" />
</switches>
<trace>
<listeners>
<add name="MyListene r" type="Common.Li steners, Common" />
</listeners>
</trace>
</system.diagnost ics>

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.con fig 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
529
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 TraceListeners through config settings such as: <system.diagnostics> <switches> <add name="MySwitch" value="31" /> </switches> <trace>
13
26622
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 the development machine. I then copy that directory to the remote server that contains numerous directories and some of them are using .NET Framework 1.1 (1.1 and 2.0 are both installed on the server). When I call the page I get the message ...
4
8250
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 work around to just requiring the user to have the Path environment setup in the calling application. class MyAssemblyLoader { public Type GetTypes(String assemblyName) {
9
480
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 aren't made available to the user because only the exe's app.config file is copied to the application's bin folder. Is this the case or am I missing something? For instance, I have a connection string and some directory paths that I want the...
2
3393
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
5736
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" and value is "monkey". I've tried the following ways to retrieve the value and only one works: //Returns null Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetEntryAssembly().Location); string monkey =...
7
5816
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 ActiveX control doesn't even seem to get loaded. (On the failing machines, if we try and debug down to where the ActiveX DLL method is invoked, both Visual Studio and IE hang.)
10
1670
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 wondering what takes precedent, what the benefit of using one vs. the other is, and what happens if they conflict?
0
1271
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 form I am not getting this part of the tag.. <ajaxToolkit:ToolkitScriptManager I also added AjaxControlToolkit.dll in the bin directory.
2
6564
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 converted to an application running in ..NET 2.X and Integrated mode. We copied over the DB and edited the web.config file to the DB username and password. I also added the NETWORK SERVICE user to the DB.
0
9670
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
9518
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
10430
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
10000
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...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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
6776
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
5436
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.