Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > .NET Framework 3.5
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 3.5 For discussion of the Microsoft .NET Framework 3.5.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 3.5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 18th, 2008, 07:17 AM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prajip Send a message via Yahoo to prajip
Default Configuration files in GAC with .NET 3.5

Does .NET 3.5 Framework support adding configuration files related to an assembly in GAC?
As an example, if assembly XXXXXX.Manufacturing.Equipment.dll needs configuration values it would expect to find them in file XXXXXX.Manufacturing.Equipment.dll.config located in the same folder as the XXXXXX.Manufacturing.Equipment.dll itself.
It is not supported in .NET 1.1 and .NET 2.0. There are many work arounds to do it.
All kinds of information is appreciated.
Reply With Quote
  #2 (permalink)  
Old June 18th, 2008, 09:08 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

The configuration file usually has the name of the executing application, not the loaded DLL.

e.g. If your application MyApp.exe loads dll MyDll.dll which is in the GAC then the configuration file it looks for it called MyApp.exe.config - even the code inside MyDll.dll.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old June 19th, 2008, 07:10 AM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prajip Send a message via Yahoo to prajip
Default

Sam,

I understand that concept. That is how it works in .NET1.1 and .NET 2.0. I was wondering if something like that is supported in .NET 3.5 framework.

We need to make a major policy decision in our organization based on that information.

We have developers who are putting assembly specific configuration files into the GAC and cluttering it. Developers have found work around to do it instead of referring to the application specific configuration file(MyApp.exe.config)

I hope I have made myself clear on the information required.


Reply With Quote
  #4 (permalink)  
Old June 19th, 2008, 10:42 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Hi

I still don't know how you can store a .config file in the GAC - I have never heard of that at all.

Though you can load a specific named configuration file its certainly not the normal thing to do.

You should also be aware that .Net 3.5 is no more than .Net 2.0 with more DLLs - it uses exactly the same GAC, and exactly the same core CLR.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #5 (permalink)  
Old June 19th, 2008, 11:29 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by prajip
 Does .NET 3.5 Framework support adding configuration files related to an assembly in GAC?

...
Quote:
quote:We have developers who are putting assembly specific configuration files into the GAC and cluttering it.
So did you answer your own question?

I would make the observation that the "Global Assembly Cache" is for assemblies and nothing else. If you developers *are* putting config files in the GAC, how are they consuming them?

-Peter
compiledthoughts.com
Reply With Quote
  #6 (permalink)  
Old June 19th, 2008, 02:57 PM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prajip Send a message via Yahoo to prajip
Default

Here is a post I found on MSDN forums.

http://forums.msdn.microsoft.com/en/...-fd7603f55ae0/

and on some blog

http://kyletillman.net/blog/post/Con...ssemblies.aspx

I guess the developers are using this technique.

Reply With Quote
  #7 (permalink)  
Old June 19th, 2008, 03:23 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Even in the instance above there is always a place that the 'executing application' can place code so that it is accessible via the standard configuration settings.

For example, if I create a .Net DLL which is COM visible, and call it from a VBScript file which I run using cscript.exe, then I can put configuration settings in a file called cscript.exe.config.
Likewise with COM+ they are loaded by dllhost.exe, so again the dllhost.exe.config file can be placed in the system32 directory - or you can specify a configuration directory under the COM+ settings.

So I cannot see a reason to have to place configuration files in the GAC. If you have a particular case that you cannot work out then let us know.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #8 (permalink)  
Old June 19th, 2008, 04:10 PM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prajip Send a message via Yahoo to prajip
Default

Sam,

I am responsible for a very critical application which is used worldwide as a standard part of our IT infrastructure. The application manages deployment of in-house applications and files on Microsoft Windows based workstation and server machines.
The user wants to add a feature in the application which will support adding configuration files in the GAC. I feel that GAC is only for shared assemblies and we should not cluter it with anything else. But before making a decision on that I want to confirm that .NET framework does not support it. If .NET framework does support it we might as well add such a feature.

Here is the argument from the developer. Let me know your views.

As we move forward with the XXXXX.Application.Framework, class libraries are being shared among the various manufacturing disciplines. It's unmanageable to have the configuration entries for the various dlls stored under the monolithic app.config of the entry assembly (e.g. foo.exe.config), especially since these dlls may plug into an unknown number of executables which would all now have to know intimate configuration details and break encapsulation as a result.

As part of the XXXXX.Application.Framework using .Net 2.0 / EnterpriseLibrary, we've provided a consistent way for developers to use separate configuration files per assembly and have made it the default with format of <assembly>.config located in the same folder as the assembly itself. As an example, if assembly XXXXXX.dll needs configuration values it would expect to find them in file XXXXXX.dll.config located in the same folder as the XXXXXX.dll itself. We found it met developer's expectations if the standard was to put the assembly config file in the same folder as the assembly itself. This works well for both client and web server deployments, where you may not know a consistent absolute path location. This is pretty easy to achieve normally but is complicated when the assembly is deployed to the GAC.

Since some of the assemblies are going to be used widely by different groups on client PCs it makes sense to deploy these to the GAC since this is the scenario that the GAC was designed for. In general, the GAC works great with the exception that it's sometimes difficult to deploy our files there and the configuration file location issue. While we could have 2 different policies on config file location (if not GAC then local folder, if GAC then absolute path), it get's messy and hampers code re-use where the assembly might be deployed to both client and web servers. Best would be if we could use the same policy for everything and just always deploy to the assembly folder, wherever that may be, GAC or non-GAC.

We do have a way to deploy config files to the same folder that GAC assemblies live in using the current application. It's a little painful and I have to make assumptions about where the GAC is located which could be a problem in the future as this location could vary (for example, differences in GAC location between 1.1 and 2.0). The config files work just fine once they are there, the only trick is finding it and making sure that the assembly itself get's there first.

The purpose of this enhancement was simply to streamline the process of adding config files to the same location as the assembly files that they go with. While directed towards GAC deployments, this could be useful for situations other than GAC or even config files. At it's heart it's a request to "slave" one file to another - deploy file Y to the same location as file X, wherever X is deployed for a particular package.

A little long winded but that's the background on why this request was made. It's not a science experiment but rather just one more attempt to establish consistency among manufacturing developers where it was lacking previously.




Reply With Quote
  #9 (permalink)  
Old June 19th, 2008, 05:56 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Well, based on the web site above it is obviously possible to place the config files in the GAC. I'm not sure I would like doing what you are proposing, but if you think there is no alternative then I can see no reason to stop you. I'm not saying I can think of a better alternative, just that it doesn't feel right :)

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Application Configuration Files semilemon C# 2005 17 April 24th, 2007 11:27 PM
Configuration Override Files Jeff Mason Visual Studio 2005 1 March 14th, 2007 09:52 AM
Installing non-assembly files in the GAC eadred .NET Framework 1.x 0 April 28th, 2006 10:12 AM
Configuration files and performance ernestlambert BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 21st, 2005 12:23 PM
Configuration files hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 23rd, 2005 09:13 AM



All times are GMT -4. The time now is 01:58 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.