[Visual Studio] [Config] [Transformation] [SlowCheetah] 在非Web工程中使用Transformation

1. 为VS安装SlowCheetah插件

  https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.SlowCheetah-XMLTransforms

2. 点击App.Config,点击 【Add Trasformation】,项目会自动下载NuGet的SlowCheetah包,然后增加Config文件

3. 为了避免发布时会将所有引用工程的Config文件发布出去,做以下措施:
  Unload Project, Edit .csproj,增加以下PropertyGroup:

  <PropertyGroup>
    <ScAllowCopyReferencedConfig Condition=" '$(ScAllowCopyReferencedConfig)'=='' ">false</ScAllowCopyReferencedConfig>
  </PropertyGroup>

如果要同时控制是否发布XML文件与PDB文件,则使用以下:

  <PropertyGroup>
    <ScAllowCopyReferencedConfig Condition=" '$(ScAllowCopyReferencedConfig)'=='' ">false</ScAllowCopyReferencedConfig>
    <AllowedReferenceRelatedFileExtensions Condition=" '$(ScAllowCopyReferencedConfig)'=='true' ">
      $(AllowedReferenceRelatedFileExtensions);
    </AllowedReferenceRelatedFileExtensions>
  </PropertyGroup>
原文地址:https://www.cnblogs.com/lionetchen/p/8397893.html