.csproj文件中的条件条件符号定义 [英] Conditional conditional symbol definition in a .csproj file

查看:225
本文介绍了.csproj文件中的条件条件符号定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一位经验丰富的C#开发人员,但是对于MSBuild来说是一个完整的初学者,现在我有了一个.csproj文件,其中包含以下XML代码段:

I am an experienced C# developer, but a complete beginner when it comes to MSBuild, and now I have a .csproj file containing the following XML snippet:

<Choose>
  <When Condition=" $(UseSimulatedResx) == true ">
    <PropertyGroup>
      <DefineConstants>$(DefineConstants);SIMRESX</DefineConstants>
    </PropertyGroup>
    ... does something else ...
  </When>
</Choose>

有没有人可以解释以上摘录的工作方式和时间?我应该在何时何地发布此UseSimulatedResx?

Is there way any anyone can explain me how and when the excerpt above should work? Where and when should I issue this UseSimulatedResx?

我要做的是尝试让SIMRESX成为我的解决方案中项目的条件编译符号,以便启用我们大量产品的某些功能.

What I have to do is try to let SIMRESX be a conditional compilation symbol for a project in my solution so as to enable some features of our massive product.

提前谢谢!

推荐答案

可以通过以下方式之一设置UseSimulatedResx:

The UseSimulatedResx can be set in one of the following ways:

  • 作为环境变量
  • 作为调用msbuild的参数(例如/p:UseSimulatedResx=true)
  • 在PropertyGroup中(例如

  • as an environment variable
  • as the parameter when invoking msbuild (e.g. /p:UseSimulatedResx=true)
  • in a PropertyGroup (e.g.

<PropertyGroup> <UseSimulateResx>true</UseSimulateResx> ... </PropertyGroup>

<PropertyGroup> <UseSimulateResx>true</UseSimulateResx> ... </PropertyGroup>

)

如果使用/v:diag(例如msbuild myProj.csproj /v:diag)调用msbuild,则将获得诊断输出,其中显示MSBuild所做的一切以及所有变量值.

If you invoke msbuild with /v:diag (e.g. msbuild myProj.csproj /v:diag) you will get the diagnostic output that shows everything MSBuild does plus all the variable values.

这篇关于.csproj文件中的条件条件符号定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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