2016-05-17 110 views
1

我已經寫了一個web-api服務並使用緩慢的獵豹來完成轉換。當我用visual studio編譯和發佈到服務器時,所有東西都是很好的,所有東西都被轉換成許多不同的配置和許多不同的配置文件(connectionStrings.config等以及web.config)。被忽略的Web配置

但是,當我用msbuild構建時,情況並非如此。使用香草web.config並且沒有任何變化。

我確定我正在運行正確的/p:Configuration,並且還嘗試了專門運行TransformAllFiles目標,但是再次生成的文件沒有考慮到我的Web.UAT.config文件。

我已經安裝了緩慢獵豹NuGet包版本2.5.15,並與Visual Studio生成項目2015年

我想要做的改變的原因是這樣我就可以與章魚收拾它,並部署到多個服務器。目前我被卡住了。

另外,如果我運行/t:TransformWebConfig目標,這確實會轉換文件,但我相信這不是slowcheetah功能,所以不是真正需要的。

步驟以重現此問題

1)創建一個Web API 2項目承擔骨頭 2)添加緩慢獵豹 3)安裝緩慢獵豹添加在爲Visual Studio 2015年預覽 4)添加一個新的配置基於發佈的UAT。 5)退出命令行。

發出命令msbuild/t:TransformAllFiles/p:Configuration = UAT .csproj。

音符輸出,你會看到類似的東西:

> G:\dev\c#\TestCheetah\TestCheetah>msbuild /t:TransformAllFiles 
> /p:Configuration=UAT TestCheetah.csproj Microsoft (R) Build Engine 
> version 14.0.25123.0 Copyright (C) Microsoft Corporation. All rights 
> reserved. 
> 
> Build started 17/05/2016 19:32:44. The target "_ConvertPdbFiles" 
> listed in a BeforeTargets attribute at "C:\Program Files 
> (x86)\MSBuild\14.0\Microsoft.Com 
> mon.targets\ImportAfter\Xamarin.Common.targets (34,37)" does not exist 
> in the project, and will be ignored. The target "_CollectPdbFiles" 
> listed in an AfterTargets attribute at "C:\Program Files 
> (x86)\MSBuild\14.0\Microsoft.Com 
> mon.targets\ImportAfter\Xamarin.Common.targets (34,70)" does not exist 
> in the project, and will be ignored. The target "_CollectMdbFiles" 
> listed in a BeforeTargets attribute at "C:\Program Files 
> (x86)\MSBuild\14.0\Microsoft.Com 
> mon.targets\ImportAfter\Xamarin.Common.targets (40,38)" does not exist 
> in the project, and will be ignored. The target "_CopyMdbFiles" listed 
> in an AfterTargets attribute at "C:\Program Files 
> (x86)\MSBuild\14.0\Microsoft.Common 
> .targets\ImportAfter\Xamarin.Common.targets (40,71)" does not exist in 
> the project, and will be ignored. Project 
> "G:\dev\c#\TestCheetah\TestCheetah\TestCheetah.csproj" on node 1 
> (TransformAllFiles target(s)). TransformAllFiles: Copying file from 
> "Web.config" to "obj\UAT\TestCheetah.csproj-sc.App.config". Done 
> Building Project 
> "G:\dev\c#\TestCheetah\TestCheetah\TestCheetah.csproj" 
> (TransformAllFiles target(s)). 
> 
> 
> Build succeeded. 
>  0 Warning(s) 
>  0 Error(s) 

注意,它說,它改變了web.config文件,但是當你看看,你會發現調試值(一個和只有變換)沒有改變。

回答

0

我研究出最終如何做到這一點。我意識到我可以在章魚環境之後簡單地重命名我的配置,並在Octopus部署用戶表單中包含自定義轉換。因此,我最初的做法是有缺陷的。我仍然使用緩慢的獵豹進行本地部署,效果非常好,但是我讓章魚爲部署的實例執行轉換來測試,UAT和生產。

這似乎是我目前嘗試實現的最初任務是慢速獵豹不可能的。