2016-05-17 155 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和生产。

这似乎是我目前尝试实现的最初任务是慢速猎豹不可能的。