禁止发布用于ClickOnce部署的调试版本 [英] Disallow publishing of debug builds for ClickOnce deployment

查看:71
本文介绍了禁止发布用于ClickOnce部署的调试版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过ClickOnce禁止发布调试版本?

Is there a way to disallow publishing of debug builds with ClickOnce?

我只想允许发布版本通过,但现在人为错误导致调试版本无法发布。偶尔溜走。

I only want to allow release builds through, but right now human error causes a debug build to slip through once in a while.

我们正在Visual Studio中发布构建。

We're publishing the build from within Visual Studio.

推荐答案

您可以做的一件事是向.csproj或.vbproj文件中添加一个条件,MSBuild在进行构建时会检查该条件。

One thing you can do is add a condition to the .csproj or .vbproj file that MSBuild will check when doing a build.

条件将检查是否正在发布,并检查构建是否为调试构建,然后执行诸如运行外部工具之类的操作,否则中断构建过程或导致

The condition would check if a publish is occurring and check if the build is a debug build, then do something like run an external tool or otherwise interrupt the build process or cause it to fail.

一个例子可能是这样的:

An example might be something like this:

<Choose>
    <When Condition=" '$(Configuration)'=='Debug' ">
        <Exec Command="C:\foo.bat" ContinueOnError="false" />
    </When>
 </Choose>

其中foo.bat是一个批处理文件,返回的非零值,从而阻止了发布的发生。

Where foo.bat is a batch file that return non-zero, thus stopping the publish from occurring.

这篇关于禁止发布用于ClickOnce部署的调试版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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