zoukankan      html  css  js  c++  java
  • 工程文件csproj使用编译条件指定属性

    csproj工程文件中有很多xml格式的属性,比如PropertyGroup、ItemGroup,某些属性操作默认是全部的或者是当前编译条件的而已,当我们想指定某些属性只在某个编译条件下发生时就可以通过以下xml属性来指定:

    Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" 或者 Condition=" '$(Configuration)' == 'Debug' "

    例如,Release和Debug都附带有xml注释文档,则这样解决:

      <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
        <DocumentationFile>binRelease
    etstandard2.0XXXX.xml</DocumentationFile>
      </PropertyGroup>
    
      <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <DocumentationFile>binDebug
    etstandard2.0XXXX.xml</DocumentationFile>
      </PropertyGroup>

    再例如,你Debug运行需要包含项目文件,即“复制到输出目录”为“如果较新则复制”/“始终复制”,但是Release或发布到生产环境时又不希望包含进去(不包含狗血、乌龙的迭代事件就少了),可以这样做:

    <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <None Update="AssetsXxxx.key">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>
  • 相关阅读:
    position笔记
    IFE-33笔记
    IFE-31 笔记
    selectedIndex
    iFE-30 笔记
    基于select的python聊天室程序
    python select网络编程详细介绍
    (转载)centos yum源的配置和使用
    python 多进程使用总结
    python迭代器实现斐波拉契求值
  • 原文地址:https://www.cnblogs.com/huangsheng/p/10612698.html
Copyright © 2011-2022 走看看