我對Sayed Hashimi和SlowCheetah公司所做的快速步驟和了不起的工作感到困惑,特別是SlowCheetah是否能夠在Build上轉換文件,而不僅僅是打包和發佈。SlowCheetah變換爲非網頁app.config
我已經安裝了SlowCheetah並且能夠自動生成控制檯應用程序的app.config的生成配置實例我正在與開發團隊一起部署。在構建上,在$(ProjectDir)\ obj \ x86 \ $(BuildConfig)目錄下創建一個新的「SlowCheetah」目錄。例如,obj \ x86 \ STAGE \ SlowCheetah目錄包含一個app.config文件,其轉換完成,如右鍵單擊STAGE轉換並選擇「View Transforms」時指示的那樣。但是,\ bin \ $(BuildConfig)目錄包含未轉換的app.config文件以及每個$(BuildConfig)轉換的所有模板,而不是替換$(BuildConfig)中的app.config文件。 bin \ x86 \ STAGE目錄與SlowCheetah中的目錄。
構建完成,沒有錯誤。
這是預期的操作還是仍然不能正常工作?
@ sayed-ibrahim-hashimi每個$(配置)都有一個轉換。在Visual Studio中查看時,轉換將正確顯示,並在\ obj目錄樹下的\ slowcheetah目錄中正確轉換。變換示例如下:
<?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部署到完整的開發組。有沒有我們可以看到的詳細日誌可能會指出細節?
App.config應該在構建時進行轉換。你能在這裏提供更具體的repro步驟嗎?你可以嘗試插入轉換來查看源文件是否被修改? –
答覆部分沒有提供足夠的空間給出詳細的答案,對於您的問題的詳細回覆以及轉換示例附加到原始帖子後面,以@ sayed-ibrahim-hashimi – EHuggins
@http://stackoverflow.com/users開頭/ 105999/sayed-ibrahim-hashimi我在VS2010中打開了診斷輸出,並看到app.config正在轉換並保存爲application.exe.config - 它包含正確轉換的web。$(Condition).config文件。我查了一下exe.config文件的細節,看到這是Windows可執行文件的正確行爲。我正在尋找一個app.config文件。看起來我是在浪費你的時間 - 感謝你的迴應,並撰寫出色的應用程序和書籍。你的MSBUILD 2nd Ed。由於某種原因每週最常使用。 – EHuggins