阻止app.config XML转换的MSBuild条件

阻止app.config XML转换的MSBuild条件,xml,msbuild,slowcheetah,xdt-transform,Xml,Msbuild,Slowcheetah,Xdt Transform,我正在使用“SlowCheetah”VS扩展来转换app.config,根据项目配置使用不同的值。因此,“调试”配置生成一个app.config,其值适用于开发人员/质量保证用户,而“发布”构建生成一个app.config,其值适用于开发人员/质量保证用户 .csproj包含如下部分: <ItemGroup> <None Include="App.config"> <SubType>Designer</SubType> <Transf

我正在使用“SlowCheetah”VS扩展来转换app.config,根据项目配置使用不同的值。因此,“调试”配置生成一个app.config,其值适用于开发人员/质量保证用户,而“发布”构建生成一个app.config,其值适用于开发人员/质量保证用户

.csproj包含如下部分:

<ItemGroup>
<None Include="App.config">
  <SubType>Designer</SubType>
  <TransformOnBuild>true</TransformOnBuild>
</None>
<None Include="App.Debug.config">
  <DependentUpon>App.config</DependentUpon>
  <IsTransformFile>True</IsTransformFile>
  <SubType>Designer</SubType>
</None>    
<None Include="App.Release.config">
  <DependentUpon>App.config</DependentUpon>
  <IsTransformFile >True</IsTransformFile>    
</None>
<None Include="packages.config" />
<None Include="Properties\SlowCheetah\SlowCheetah.Transforms.targets" />
我尝试在.csproj文件的几个地方使用此条件,但没有成功。我怀疑,如果我修改“SlowCheetah.Transforms.targets”文件本身,就可以实现这一点,但不应根据顶部的注释修改该文件


理想情况下,我希望Visual Studio内部版本的所有配置都使用我的调试配置文件,Visual Studio外部的“发布”版本(例如在持续集成服务器上的版本)使用Prod app.config,但我希望能够在Visual Studio内防止意外运行“发布”版本。对于是否/如何实现这一目标的任何建议,我们表示感谢

之前添加以下内容:



这项工作做得很好。谢谢。使用相同条件的一个好方法是在app.config中指定DEV值,并为“Release”配置单独转换。然后将“条件”放在“SlowCheetah”属性组中。结果是,转换仅在构建外部VS时发生。构建内部VS时,始终以DEV app.config文件结束$([System.IO.Path]::GetFullPath($(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.15\tools))。。。。
Condition=" '$(BuildingInsideVisualStudio)'=='true' "
  <Target Name="BeforeBuild">
    <Error Condition=" '$(BuildingInsideVisualStudio)'=='true' And '$(Configuration)'=='Release' "
           Text="JMc is so mad at you you trying to build using the Release configuration from Visual Studio." />
  </Target>