3

我有一个包含 asp.net C# 项目、4.0 框架的 VS 2010 解决方案。我们使用 Teamcity 7.1.1(build 24074)作为 CI 和部署服务器。

我们升级到 Visual Studio 2012 并转换了这个解决方案,还在构建服务器上安装了Microsoft Visual Studio 2012 Shell (Integrated) Redistributable Package,以便拥有构建 Visual Studio 应用程序所需的所有文件,包括 [..]\MSBuild\Microsoft\VisualStudio \v11.0\WebApplications\Microsoft.WebApplication.targets。

转换到 2012 后,我注意到部署不再起作用,没有创建工件(但 Teamcity 也没有抱怨!)。我只在构建日志上得到这个:

[...]
[17:11:58][Providers\Providers.csproj.teamcity] GetCopyToOutputDirectoryItems
[17:11:58][Providers\Providers.csproj.teamcity] _CopyOutOfDateSourceItemsToOutputDirectoryAlways
[17:11:58][_CopyOutOfDateSourceItemsToOutputDirectoryAlways] Copy
[17:11:58][Copy] Copying file from "C:\TeamCity\buildAgent\work\c52628138e1ee4d4\Providers\NLog.config" to "bin\NLog.config".
[17:11:58][Providers\Providers.csproj.teamcity] CopyFilesToOutputDirectory
[17:11:58][CopyFilesToOutputDirectory] Copy
[17:11:58][Copy] Copying file from "obj\Release\Providers.dll" to "bin\Providers.dll".
[17:11:58][CopyFilesToOutputDirectory] Providers.csproj -> C:\TeamCity\buildAgent\work\c52628138e1ee4d4\Providers\bin\Providers.dll
[17:11:58][CopyFilesToOutputDirectory] Copy
[17:11:58][Copy] Copying file from "obj\Release\Providers.pdb" to "bin\Providers.pdb".

==> [17:11:58]Process exited with code 0

[17:11:58]Publishing internal artifacts
[17:11:58][Publishing internal artifacts] Sending build.finish.properties.gz file
[17:11:58]Publishing artifacts
[17:11:58][Publishing artifacts] Collecting files to publish: [Providers\obj\Release\Package]

==> [17:11:58][Publishing artifacts] Artifacts path Providers/obj/Release/Package not found

[17:11:58]Build finished

对解决方案所做的唯一更改是在 .sln 和 .csproj 文件中(通过 Visual Studio)。如果我恢复到以前的版本,teamcity 可以毫无问题地构建和部署。对项目文件的更改与本文中解释的相同,我尝试了建议的解决方案(将 VisualStudioVersion=11.0 传递给 MSBuild),但没有成功。

如果我使用解决方案资源管理器中的发布链接从 Visual Studio 进行部署,它也可以按预期工作。我将在 VS 2012 中创建一个带有基础项目的新解决方案,并将测试它是否从 Teamcity 部署。

还有其他想法吗?

- - 更新 - -

希望这不是解决方案:我按照上面帖子的建议做了相反的事情,我设置了 MSBuild 参数 VisualStudioVersion=10.0 并且它有效!所以,为了部署一个 VS 2012 项目,我不得不将其视为 VS 2010 项目......你在做什么不同?为了能够在不欺骗teamcity的情况下进行部署,我应该做什么?

- - 更新 - -

我正在添加一些我的 TeamCity 配置的快照。Teamcity 将系统和环境变量作为构建参数传递给 MSBuild

通用设置

构建步骤

微软构建

配置参数

4

1 回答 1

3

更新

澄清一下,问题在于 Web Publishing Pipeline 目标 ( $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets) 没有作为 VS 2012 的 Integrated Shell 版本的一部分安装。

该问题可以通过安装完整版本的 VS 2012 来解决,或者可能通过在 VS Shell 之上安装 Azure SDK 来解决。

于 2012-11-02T02:37:47.683 回答