Spring配置文件编辑后强制重建
在我们的 C# 项目中,我们使用 Spring 作为控制反转 (IoC) 容器。我们注意到,对 Spring 配置 xml 文件的更改不会导致解决方案被重建。因此,更改后的配置不会复制到输出文件夹,并且每次调试运行都使用旧配置。
即使项目代码没有更改,我们如何强制 Visual Studio (2008) 复制配置文件?
更多信息: 配置文件的构建操作设置为无。 “复制到输出目录”设置为始终复制。
In our C# project we use Spring as an Inversion of Control (IoC) container. We noticed, that changes to the Spring configuration xml file do not cause the solution to be rebuild. Therefore the changed configuration is not copied to the output folder and every debug-run uses the old configuration.
How can we force Visual Studio (2008) to copy the config file even though none of the project code has changed?
Further info:
The build action of the config file is set to None. Copy to Output Directory is set to Copy always.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来解决方案比我想象的要简单。如果 *.xml 配置文件的构建操作更改为
嵌入资源
,则更改文件也会影响项目。因此,每个调试周期都会导致项目重建,其中包含配置文件。这会导致文件被复制到具有调整后的配置的输出目录。 =>问题解决了。Seems the solution is simpler than I thought. If the build action for the *.xml config file is changed to
Embedded Resource
, then changing the file also touches the project. Therefore, every debug cycle causes a rebuild of the project, where the config file is included. This causes the file to be copied to the output directory with the adjusted configuration. => Problem solved.