防止使用 ClickOnce 部署调试版本
我正在使用 VS2008 发布 ClickOnce 应用程序,但在每次发布之前我都必须手动切换到发布配置。只要我不忘记切换就可以了。有没有办法阻止部署调试版本?是否有一些编译器指令,例如:
#if DEBUG
#if ClickOnce
#error You cannot publish a debug build
#endif
#endif
或者有没有一种方法(无需构建脚本)在发布之前自动切换到发布配置?
(我发现了一些类似的问题,但不喜欢它们的答案)
谢谢
I'm publishing a ClickOnce application with VS2008, but before every publish I have to switch to Release config manually. This is fine as far as I don't forget to switch. Is there a way to prevent deploying debug builds ? Is there some compiler directive like:
#if DEBUG
#if ClickOnce
#error You cannot publish a debug build
#endif
#endif
Or is there a way (without build scripts) to automatically switch to Release config before publishing ?
(I've found some similar questions but didn't like the anwsers on them)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定这是否令人皱眉,但请在相关线程中查看我的答案:
https://stackoverflow.com/a/15080048/ 571237
简而言之,您可以修改项目文件以在发布之前检查调试符号,如果找到则抛出错误条件。这可以防止在不需要任何 .bat 文件或外部处理的情况下进行部署。
Not sure if this is frowned upon, but please see my answer in the related thread:
https://stackoverflow.com/a/15080048/571237
In short you can modify the project files to check for debug symbols before publishing, and throw an error condition if they're found. This prevents the deploy from happening without needing any .bat files or external processing.
到目前为止我发现的最好的解决方案是编写一个基于以下内容的 vs2008 加载项: http://msdn.microsoft.com/en-us/library/ms165638.aspx
任何其他想法表示赞赏。
The best solution I've found so far is to write a vs2008 add-in based on: http://msdn.microsoft.com/en-us/library/ms165638.aspx
Any other ideas are appreciated.