Changing the config file in a Visual Studio Package
Asked Answered
G

2

6

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 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#.

Greenberg answered 18/5, 2010 at 8:18 Comment(0)
G
8

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.

Greenberg answered 31/5, 2010 at 14:5 Comment(0)
A
0

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).

Aldus answered 18/5, 2010 at 8:22 Comment(1)
Thanks for the quick answer. I think it's different with a Visual Studio package. It doesn't compile as an executable, but as a dll and a vsix, but true, the method is similar. I would prefer not to change anything in the devnev.exe.config file.Greenberg

© 2022 - 2024 — McMap. All rights reserved.