I'm building a Visual Studio Package and associated with it, I have an app.config file (which contains some information about connecting to a WCF service).
As far as I can tell, this package is actually connecting to the devnev.exe.config configuration file (if I use AppDomain.CurrentDomain.SetupInformation.ConfigurationFile), it will retrieve the path to the devnev.exe.config
Firstly, is this correct? Shouldn't开发者_StackOverflow中文版 the package automatically pick up the app.config file? If this is the case, then how can I make the project use the app.config file?
I'm running VS2010 Ultimate, programming in C#.
A Visual Studio Package will take the devnev.exe.config configuration file as its main configuration file. If you add an app.config file into the project, it will not accept it. This is because the package is running within Visual Studio, therefore it is accepting Visual Studio's config file.
At the same time it is not good practice to change the devnev.exe.config file, since once you deploy your application, the user will also have to change that file (and on the whole, you shouldn't change that file).
What I ended up doing is connecting to the WCF service programmatically.
Hope this helps somebody.
When you compile your project the app.config is compiled as [exe].config.
If you want to change configuration you can change the content of [exe].config (it's a plain text document).
精彩评论