Visual studio 2015 正在忽略Web配置

Visual studio 2015 正在忽略Web配置,visual-studio-2015,msbuild,slowcheetah,Visual Studio 2015,Msbuild,Slowcheetah,我编写了一个web api服务,并使用慢速cheetah进行转换。当我使用visual studio编译并发布到服务器时,一切都很好,所有内容都在许多不同的配置和许多不同的配置文件(connectionStrings.config等以及web.config)中转换 但是,当我使用msbuild构建时,情况并非如此。使用vanilla web.config,不进行任何转换 我已确保使用正确的/p:Configuration运行,并尝试运行TransformAllFiles目标,但生成的文件没有考虑

我编写了一个web api服务,并使用慢速cheetah进行转换。当我使用visual studio编译并发布到服务器时,一切都很好,所有内容都在许多不同的配置和许多不同的配置文件(connectionStrings.config等以及web.config)中转换

但是,当我使用msbuild构建时,情况并非如此。使用vanilla web.config,不进行任何转换

我已确保使用正确的
/p:Configuration
运行,并尝试运行
TransformAllFiles
目标,但生成的文件没有考虑我的Web.UAT.config文件

我已经安装了slow cheetah nuget软件包版本2.5.15,该项目是使用visual studio 2015生成的

我想进行转换的原因是,我可以用八达通将其打包并部署到多个服务器。此刻我被困住了

另外,如果我运行
/t:TransformWebConfig
目标,这确实会转换文件,但我相信这不是slowcheetah功能,因此不是真正需要的

复制此问题的步骤

1) 创建web api 2项目bear bones 2) 添加慢猎豹 3) 安装visual studio 2015预览版的slow cheetah加载项 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文件,但当您查看时,您会注意到调试值(唯一的转换)没有更改。

我最终找到了如何执行此操作。我意识到我可以简单地在octopus中的环境之后重命名我的配置,并在octopus部署用户表单中包含自定义转换。因此,我最初的方法是有缺陷的。我仍然使用slow cheetah进行本地部署,这非常有效,但我让octopus为部署的实例执行转换,以进行测试、UAT和生产


现在看来,我试图完成的最初任务在慢猎豹身上是不可能完成的。

我最终想出了如何做到这一点。我意识到我可以简单地在octopus中的环境之后重命名我的配置,并在octopus部署用户表单中包含自定义转换。因此,我最初的方法是有缺陷的。我仍然使用slow cheetah进行本地部署,这非常有效,但我让octopus为部署的实例执行转换,以进行测试、UAT和生产

看来我试图完成的最初任务在这个时候是不可能的