Settings.settings文件变化的app.config后强制再生 [英] Force regeneration of Settings.settings file after change in app.config

查看:163
本文介绍了Settings.settings文件变化的app.config后强制再生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自动生成过程设置应用程序的一个特定的模式(如开发,UAT,住)。根据该模式,我想更新连接字符串相关的。

I have an automated build process that sets up the application for a specified mode (e.g. Dev, uat, live). Depending on this mode I want to update Connection Strings to the relevant one.

不过,在我的数据访问层有存储连接字符串的app.config文件,这是用来喂Sett​​ings.Settings文件。在我的建设者我更新的app.config的XML与新的连接字符串,然后生成解决方案,但是Settings.setting文件没有得到再生与更新的app.config连接字符串,因此应用程序无法连接到正确的DB。

However, in my Data Access Layer there is an app.config file which stores the connection string and this is used to feed the Settings.Settings file. In my builder I update the app.config's xml with the new Connection String and then the solution is built, however the Settings.setting file doesn't get regenerated with the updated app.config connection string and so the app doesn't connect to the correct DB.

是否有可能做到这一点还是我通过这些配置/设置文件是如何工作的一个误区绕了错误的方式?

Is it possible to do this or am I going about it the wrong way through a misunderstanding of how these config/settings files work?

谢谢 斯图尔特

推荐答案

是啊,你这样做是倒退。 IDE生成从您在设置设计者定义设置config文件的内容。这并不是其他的方式来工作。如果得到连接字符串直接从构建有效是很重要的,然后设置默认的设置设计师。还是不要将其存放在一个设定。

Yeah, you're doing it backwards. The IDE generates the .config file contents from the settings you define in the Settings designer. That doesn't work the other way around. If getting the connection string valid straight from the build is important then set the default in the Settings designer. Or don't store it in a setting.

这篇关于Settings.settings文件变化的app.config后强制再生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆