c# - Visual Studio 构建事件条件不相等

标签 c# visual-studio

<分区>

有没有办法在构建事件中设置不相等的条件?

像这样:

if $(ConfigurationName) != Debug xcopy ...

请注意,这是构建事件(类似批处理的语法),而不是 MSBuild 任务(确实支持 != )。

最佳答案

更新:

不好意思,我以为它是为 MSBuild 而设计的。但是,如果它仅用于构建事件,那么它将像 batch 脚本一样工作

if not "$(ConfigurationName)" == "Debug" (
  echo "hello world"
)

对于 MSBuild

就像是在关注

Condition="'$(Configuration)'!='DEBUG'"

例如:

<When Condition=" '$(Configuration)'!='DEBUG' ">
....
</When>

查看详情 MSBuild condition

关于c# - Visual Studio 构建事件条件不相等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34682325/

相关文章:

.net - 在 Visual Studio 2019 上使用 .sass 扩展文件

visual-studio - 如何在Ms cobol 2.20中调试

c# - 通用列表不一致的可访问性

c# - 无法通过 VPN 以编程方式访问网络路径

c# Winform Controls to VSTO Excel Addin 如何取回值(value)。

C# 枚举、结构和类

visual-studio - "GetReferenceNearestTargetFrameworkTask"未找到任务

C# 编码 C++ 结构继承

visual-studio - MS建立记录

c# - 使用 "Treat warnings as errors"时忽略生成的文件