tags:

views:

123

answers:

2

Hi,

I am writing a VS2008 add-in that connects to a remote database blah blah.

I am having a problem with the app.config in this project. When I use SubSonic in my code, it moans that is cannot find the SubSonicServer section. This is because the .config file cannot be found. This appears to a problem with paths as the add-in is a DLL running in the context of VS2008 and the working directory is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE.

Is there a way to get the app.config to deploy properly with the application so my add-in (and SubSonic) can find what it needs in the .config file, or is there a way to get SubSonic to work without the need for the .config?

I am very experienced in SubSonic projects now, but only winforms, web, web service, and WPF applications. This is the first time I have tried to use SubSonic in a VS2008 Add-In project. I also have AppSettings in the config file which the ConfigurationManager cannot read because it cannot see the .config file.

2AM now and brain is tired of trying to figure this one out. Hopefully there is an answer when I wake up :)

TIA

+1  A: 

My suggestion would be to not use the app.config file and inject the parameters at runtime.

I use this approach in my Subsonic 2.2 project:

http://www.digvijay.eu/digvijay.eu/post/2008/10/31/SubSonic-Trick-Specify-connection-string-at-runtime!.aspx

SchlaWiener
This solution works 100% for me. Thank-you very much!!
+1  A: 

You might want to have a look at the answer to this question which deals with configuration for add-ins:

http://stackoverflow.com/questions/344024/how-to-use-app-config-with-visual-studio-add-in

Adam