首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >非web app.config的SlowCheetah转换

非web app.config的SlowCheetah转换
EN

Stack Overflow用户
提问于 2013-03-30 02:26:38
回答 2查看 2.2K关注 0票数 3

我对赛义德·哈希米和他的公司在SlowCheetah上所做的快节奏和出色的工作感到困惑,特别是SlowCheetah是否能够在构建时转换文件,而不仅仅是打包和发布。

我已经安装了SlowCheetah,并且能够为我正在与开发团队一起部署的控制台应用程序的app.config自动生成构建配置实例。在构建时,将在$(ProjectDir)\obj\x86\$(BuildConfig)目录下创建一个新的"SlowCheetah“目录。例如,obj\x86\ STAGE \SlowCheetah目录包含一个完成了转换的app.config文件,如右键单击STAGE转换并选择"View Transforms“时所示。

但是,\bin\$(BuildConfig)目录包含未转换的app.config文件以及每个$(BuildConfig)转换的所有模板,而不是将bin\x86\STAGE目录中的app.config文件替换为SlowCheetah中的文件。

构建完成,没有错误。

这是预期的操作,还是仍然不能正常工作?

@sayed ibrahim-hashimi每个$(配置)都有一个转换。在Visual Studio中查看时,转换会正确显示,并且会在\obj目录树下的\slowcheetah目录中正确转换。转换的示例如下:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform
<connectionStrings>
<add name="Portal" connectionString="Data Source=transformtestserver.domain.local;Initial Catalog=TestDB;User Id=TestUser;Password=testpw1;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="DictionaryDatabase" connectionString="Data Source=transformtestserver.domain.local;Initial Catalog=TestDB;User Id=TestUser;Password=testpw2;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="LoggingDatabase" connectionString="Data Source=transformtestserver.domain.local;Initial Catalog=TestDB;User Id=TestUser;Password=testpw3;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>    
</connectionStrings>
</configuration>

该问题可能与Nuget/解决方案配置有关。我正在处理的项目是一个非常大的解决方案的一部分。我在安装和运行SlowCheetah时遇到了很大的困难--有一次我发现Nuget说SlowCheetah已经安装了,但是解决方案包目录中并不包含SlowCheetah。

我在TeamCity中设置了一个变通方法,以便从\obj目录中拾取转换后的app.config文件,但是我真的想解决这个问题,这样我就可以向整个开发团队推出SC。有没有我们可以查看的详细日志,可以指出细节?

EN

回答 2

Stack Overflow用户

发布于 2014-01-06 14:07:33

我也面临着同样的问题。

在VS中的本地编译工作很棒,但是在构建代理(TeamCity)上转换魔术并没有发生!

我找到的与项目文件中的xml元素的位置相关的解决方案

代码语言:javascript
复制
  <PropertyGroup Label="SlowCheetah">
    <SlowCheetahToolsPath>$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.10.3\tools\))</SlowCheetahToolsPath>
    <SlowCheetah_EnableImportFromNuGet Condition=" '$(SC_EnableImportFromNuGet)'=='' ">true</SlowCheetah_EnableImportFromNuGet>
    <SlowCheetah_NuGetImportPath Condition=" '$(SlowCheetah_NuGetImportPath)'=='' ">$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets ))</SlowCheetah_NuGetImportPath>
    <SlowCheetahTargets Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='true' and Exists('$(SlowCheetah_NuGetImportPath)') ">$(SlowCheetah_NuGetImportPath)</SlowCheetahTargets>
  </PropertyGroup>

我注意到,当PropertyGroup凌驾于ItemGroup`s的元素之上时,MsBuild.exe最终完成了转换

票数 3
EN

Stack Overflow用户

发布于 2014-01-30 15:45:48

查找重复的SlowCheetahTargets部分-我有一个较旧的版本和一个较新的版本,较旧的版本指向一个在nuget包目录中不再存在的位置。

删除旧的/重复的SlowCheetahTargets部分的整个属性组,这应该会修复它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15709190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档