Subsonic in a VS2008 Add-In woes

六月ゝ 毕业季﹏ 提交于 2019-12-11 04:53:49

问题


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:


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




回答2:


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

How to use app.config with Visual Studio add-in?



来源:https://stackoverflow.com/questions/1151240/subsonic-in-a-vs2008-add-in-woes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!