Sharing Config settings between Web App and Console App

∥☆過路亽.° 提交于 2020-01-02 04:24:07

问题


I'd like to share my VS2010 3.5 Web Apps settings with my Console App's (2 projects in the same solution).

eg connection string, smtp, log4net settings

This looked close:

http://devlicio.us/blogs/derik_whittaker/archive/2008/04/15/how-to-share-configuration-files-between-projects.aspx


回答1:


The big difference is step 1 (save your special settings in external .config files)

  1. Put your shared .config into external files (attribute on element: configSource="mySpecialConfig.config")
  2. Add the files in a common folder in your solution
  3. Add the files as linked items to each project


来源:https://stackoverflow.com/questions/3553002/sharing-config-settings-between-web-app-and-console-app

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