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:
<Project that gets deployed -- web browser>
571 app.config <File that has the configuration settings.>
<DIR> bin <Where the DLL is>
|__________________> Staff.Browser.Web.dll <Where the compiled configuration manager is>
<DIR> ClientBin
<DIR> images
<DIR> 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

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.


This article has been dead for over six months. Start a new discussion instead.