VS 安装项目目标 app.config 位于 ..obj\x86\Release
我使用 Dan Abramov 的解决方案 此处。效果很好,配置文件已转换并存在于正确的 obj 文件夹中。
当我查看应用程序主输出的输出时,它从项目目录中获取 app.config
而不是像其他所有内容一样从相应的 obj 文件夹中获取......在我看来,这是一个很大的疏忽,由微软金融服务公司提供。显然,他们并没有考虑到所有配置文件类型的转换。
那么现在,如何获取主项目的主输出以根据构建配置从 obj 文件夹输出配置文件?
I created an app.config
transform for my WinForms project using Dan Abramov's solution here. Works great and the config file is transformed and present in the correct obj folder.
When I look at the outputs for the Primary Output of my application, it gets the app.config
from the project directory instead of the corresponding obj folder like everything else...a big oversight, in my opinion, by MSFT. Obviously, they didn't have transforms in mind for all config file types.
So now, how do I get the Primary Output of my main project to output the config file from the obj folder based on the build configuration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用 SlowCheetah (VS 扩展)来帮助您以与 web.config 相同的方式转换 app.config。还支持为安装项目转换 app.config 的场景。
Have you tried using SlowCheetah (a VS extension) which enables you to transform app.config in the same way that web.config works. Also your scenario for transforming app.config for a setup project is supported.
我在此处找到了我正在寻找的工作。滚动到底部并查看 kakoskin 的答案。结合 Dan Abramov 的解决方案,我能够得到我正在寻找的结果。这是我使用的 MSBuild 代码:
部分将从相应的 obj\ 文件夹中删除 app.config 文件,并将其替换为转换后的配置文件,这不是必需的,但我还是将其留在那里。希望这也能帮助其他人!
I found the work around I was looking for here. Scroll to the bottom and see kakoskin's answer. In conjunction with Dan Abramov's solution, I was able to get the results I was looking for. Here's the MSBuild code I used:
The
<ItemGroup>
section will remove the app.config file from the corresponding obj\ folder and replace it with the transformed config file, which is not needed but I left it in there anyways.Hope this helps others out as well!