Publish doesn't work from build definition VS2

2019-07-19 15:14发布

问题:

What I thought would be simple is not. All I am trying to do is get MSBuild to copy website files to another server after my build.

In my Build definition Under Process --> Advance --> MSBuild Arguments I put

/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile

It builds fine but it never copies files to destination

BUT when I run this command locally, IT WORKS!!!!!

msbuild /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile

I have VS 2012 installed in Build Server so I think all the necessary files are there.

What is the problem?

UPDATE 1

Output in build log file

Run MSBuild for Project

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\MyProject\MyProject\src\MyProject.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\MyProject\MyProject\src\MyProject.log;encoding=Unicode;verbosity=detailed" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile /p:VisualStudioVersion=11.0 /m /p:OutDir="C:\Builds\1\MyProject\MyProject\bin\\" /p:RunCodeAnalysis="False" /p:VCBuildOverride="C:\Builds\1\MyProject\MyProject\src\MyProject.sln.vsprops"  /dl:WorkflowCentralLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;BuildUri=vstfs:///Build/Build/64;InformationNodeId=20178;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://abc-tfs-p:8080/tfs/defaultcollection;"*WorkflowForwardingLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;"

REPRODUCTION STEPS

  1. Created new website project
  2. Made sure it worked on local machine using development server
  3. Checked code in TFS
  4. Created a build definition using all the default settings Under the Process --> Advance --> MSBuild Arguments I put

/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile

The publish profile copies the changeset to a remote server.

回答1:

Installing the Web Tools 2012.2 update on the build server fixed this issue for me after I read this post and Scott Gu's Blog. I don't have Visual Studio installed on the server but installing the update got my DeployOnBuild working. I hope that helps.