Msbuild TeamCity赢了';t使用MsDeploy发布项目

Msbuild TeamCity赢了';t使用MsDeploy发布项目,msbuild,teamcity,msdeploy,webdeploy,msbuild-4.0,Msbuild,Teamcity,Msdeploy,Webdeploy,Msbuild 4.0,我使用msbuild命令发布项目(WCF服务应用程序),如下所示: msbuild FooBar.Service.csproj /p:DeployOnBuild=true; DeployTarget=MsDeployPublish; MSDeployServiceUrl=http://server.pl/MSDeployAgentService; DeployIisAppPath="Foobar"; MSDeployPublishMethod=RemoteAgent; UserName=Joe;

我使用msbuild命令发布项目(WCF服务应用程序),如下所示:

msbuild FooBar.Service.csproj /p:DeployOnBuild=true;
DeployTarget=MsDeployPublish;
MSDeployServiceUrl=http://server.pl/MSDeployAgentService;
DeployIisAppPath="Foobar";
MSDeployPublishMethod=RemoteAgent;
UserName=Joe;
password=secret;
这在VS命令提示符下工作,所有内容都是在没有任何错误的情况下发布的。请注意,我没有指定任何目标

但是我想使用TeamCity(7.1.5)创建我的部署项目。我通过一个构建步骤完成了简单的项目和配置:

问题是,当我运行此任务时,msbuild编译我的站点,但未将其发布到远程服务器。以下是生成日志:

[16:13:16]Checking for changes
[16:13:18]Publishing internal artifacts
[16:13:18][Publishing internal artifacts] Sending build.start.properties.gz file
[16:13:18]Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[16:13:18]Checkout directory: C:\TeamCity\buildAgent\work\2eecf7b45f277a61
[16:13:18]Repository sources transferred
[16:13:18]Updating sources: server side checkout
[16:13:18]Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\2eecf7b45f277a61 /msbuildPath:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
[16:13:18]in directory: C:\TeamCity\buildAgent\work\2eecf7b45f277a61
[16:13:20]Foobar.csproj.teamcity: Build target: Build
[16:13:20][Foobar.csproj.teamcity] CoreCompile
[16:13:20][CoreCompile] Csc
[16:13:20][Csc] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Configuration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.EnterpriseServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ServiceModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ServiceModel.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.ApplicationServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.DynamicData.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Entity.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Extensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Services.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /optimize- /out:obj\Debug\Foobar.dll /subsystemversion:6.00 /target:library /utf8output Service1.svc.cs IService1.cs Properties\AssemblyInfo.cs "C:\TeamCity\buildAgent\temp\buildTmp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
[16:13:20][Foobar.csproj.teamcity] CopyFilesToOutputDirectory
[16:13:20][CopyFilesToOutputDirectory] Copy
[16:13:20][Copy] Copying file from "obj\Debug\Foobar.dll" to "bin\Foobar.dll".
[16:13:20][CopyFilesToOutputDirectory] Foobar.csproj -> C:\TeamCity\buildAgent\work\2eecf7b45f277a61\bin\Foobar.dll
[16:13:20][CopyFilesToOutputDirectory] Copy
[16:13:20][Copy] Copying file from "obj\Debug\Foobar.pdb" to "bin\Foobar.pdb".
[16:13:19]Targets was not defined in the build configuration.
[16:13:19]MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[16:13:21]Process exited with code 0
[16:13:21]Publishing internal artifacts
[16:13:21][Publishing internal artifacts] Sending build.finish.properties.gz file
[16:13:21]Publishing artifacts
[16:13:21][Publishing artifacts] Collecting files to publish: [C:\TeamCity\buildAgent\work\2eecf7b45f277a61]
[16:13:21][Publishing artifacts] Sending
[16:13:21]Build finished

我没有深入研究过这一点,但注意到在命令行示例中,您指定了
deployiisappath
,但看起来您在TeamCity脚本中使用了
DeployAppPath
,我认为MSBuild会忽略它

visual studio 2013项目也有同样的问题。另一个配置只是构建和部署良好

值得注意的是,您会收到以下警告:

MSBuild command line parameters contain "/property:" or "/p:".
It is recommended to define System Property on Build Parameters instead.
它的意思是,将大量参数传递给基于命令行的执行的最佳实践是将参数定义为系统属性,而不是将它们显式地连接在一个长字符串中


作为重构的建议,我建议您将要传递的参数/p:prefix定义为系统属性(这可以在构建配置的构建参数部分完成)。在这种情况下,它们将被传递到幕后执行,并将帮助您避免重复、易于维护等等。它还将使参数列表更加清晰,并帮助您找出传递给MSBuild的参数是否存在可能导致问题的错误。

您是否发现了问题所在?我也有同样的困难。对不起@Jeremyholovas,我现在记不起来了,这太旧了。