954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Dll configuration file.

Hi,

I have a small problem with a DLL. The code for the solution is split into several projects which are then compiled and deployed to a web server.

When the project is within Visual Studio I used a Linked file to get the contents of an app.Config file (XML) which as I have said is within the (soon to be compiled project) as a linked file to one within another project that is to be deployed. The project that works out the configuration is compiled as a dll and is included in the browser projec:

private static void ReadSettings()
        {
            // Get the name of the executing assemby 
            string assemblyName = Assembly.GetExecutingAssembly().FullName;
            assemblyName = assemblyName.Substring(0, assemblyName.IndexOf(','));
            string url = String.Format("{0};component/Resources/app.config", assemblyName);
              StreamResourceInfo configFile = Application.GetResourceStream(new Uri(url, UriKind.Absolute));
            if (configFile != null && configFile.Stream != null)
            {
                Stream stream = configFile.Stream;
                XDocument document = XDocument.Load(stream);
                foreach (XElement element in document.Descendants("appSettings").DescendantNodes())
                {
                    AppSettings.Add(element.Attribute("key").Value, element.Attribute("value").Value);
                }

            }
        }



which works fine when running as local host. However when this is compiled and shipped over to the test server then due to the need to edit the configuration file there is a problem with the fact that the linking does not work any more.

has anyone else come accross this issue? I was thinking that I could resolve this issue by using some file traversal but alas this hasn't worked yet. My thinking was thus:

571 app.config bin
|__________________> Staff.Browser.Web.dll ClientBin
images
Javascript
7,680 Silverlight.js
3,323 StaffBrowser.html
271 Web.config
And then I was going to do something like:

string url = "../../app.config"


Any ideas?

Thanks --Taylby

taylby
Newbie Poster
24 posts since Feb 2010
Reputation Points: 10
Solved Threads: 2
 

I still havent found the answer to this solution; However a work around that I have been able to do is using the init params which is dynamically generated from an aspx page and then fed into my silver light application.

--Taylby

taylby
Newbie Poster
24 posts since Feb 2010
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: