SlowCheetah - Web.config Transformation Syntax now generalized for any XML configuration file

SlowCheetah - Web.config Transformation Syntax now generalized for any XML configuration file

1.通过NuGet安装https://www.nuget.org/packages/Microsoft.VisualStudio.SlowCheetah/

2.通过vs的configuration manager添加新的配置

3.右键选中App.config, add transform就可以自动添加App.Debug.config和App.Release.Config,

如果你有自己另外添加配置,比如Test,也会自动生成App.Test.config

 

也可以直接安装插件,然后右键add transform。这个插件本身会帮你安装NuGet和生成文件。

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

 

SlowCheetah vs插件

Transform xml and json files at build time based on configuration. Contains tooling to assist in the creation and previewing of transform files.

根据文件类型不同,菜单和行为都有区别

 

Web.config的右键菜单是 Add Config Transform,

行为:会根据configuration manager里面的种类来添加Web.Test.config这种文件,项目文件的修改仅仅包含引用这些新生成的文件。

 

 

App.config的右键菜单是Add Transform

行为:会根据configuration manager里面的种类来添加Web.Test.config这种文件,

          项目文件的时候,会多出

<TransformOnBuild>true</TransformOnBuild>以及

<Import Project="..\..\Solution\packages\Microsoft.VisualStudio.SlowCheetah.4.0.8\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\..\Solution\packages\Microsoft.VisualStudio.SlowCheetah.4.0.8\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\..\Solution\packages\Microsoft.VisualStudio.SlowCheetah.4.0.8\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Solution\packages\Microsoft.VisualStudio.SlowCheetah.4.0.8\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
  </Target>

 

另外,当你右键选中比如Web.Debug.config上,有一个preview transorm的菜单,可以预览transform apply之后的效果。

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(52)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-12-06 用select拼接insert into,单引号转义
2017-12-06 File and Folder Permissions
点击右上角即可分享
微信分享提示