如何在 Visual Studio 2010 中自动将 app.config 更改传播到 .settings 文件
我有一个带有自定义预构建步骤的项目,该步骤修改我的 app.config 文件。此修改将传播到项目中的 Settings.settings 文件,但前提是我双击此 Settings.settings 文件并在提示我执行更新的对话框中单击“是”。
我正在寻找一种方法来跳过需要双击 Settings.settings 文件并在出现提示时单击“是”的手动步骤。换句话说,我想要一种自动更新此设置文件的方法,以便该项目的其他贡献者不需要每次都记住执行此操作。
在这一点上,我愿意接受迂回方法,尽管手动修改 .settings 文件是极端的做法。 Visual Studio 已经知道如何做到这一点,因此如果可能的话,我想利用这一事实。
I have a project with a custom pre-build step which modifies my app.config file. This modification will propagate to a Settings.settings file in the project, but only if I double-click this Settings.settings file and click Yes in the dialogs which prompt me to perform the update.
What I'm looking for is a way to skip that manual step of needing to double-click the Settings.settings file and click Yes when prompted. In other words, I would like a way to automatically update this Settings file so that other contributors to the project won't need to remember to do this every time.
At this point I'm willing to accept roundabout methods, though manually modifying the .settings file is on the extreme end. Visual Studio already knows how to do it, so I'd like to leverage that fact if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是不可能的(除了手动修改文件并对其进行修改)。不确定。
.
争论的焦点是这是否重要:
我的理解是,运行时的应用程序将查找 app.config 中的值,并且该值将覆盖其他任何值。设置中的值仅在缺少 app.config 值的情况下使用。因此,您实际上不需要更改 .settings 中的值。我会让它们始终为空或其他内容。
I don't think it can be done (except modifying the file manually and them to it as well). Not sure.
.
The argument is whether this matters:
My understanding is that the app in runtime will look for the value in app.config and this value will override anything else. The value in settings will only be used in the absence of the app.config values. So, you don't really need to change the values in .settings. I'd leave them always empty or something.