I'm trying to set up automated deployment of a Website (not web app) to a local test server. Publishing from VS2013 works fine but trying to run it from TeamCity 8.1.4 (build 30168) with MSDeploy I keep getting the following error:
Failed to start MSBuild.exe. Failed to detect default target(s) in the project file \App_Data\PublishProfiles\DeployToLocalTest.pubxml. Please define targets explicitly in the build configuration options on TeamCity Web UI. Project does not define DefaultTargets or InitialTargets.
Build Step Command line parameters:
/P:Configuration=%env.Configuration%
/P:DeployTarget=MSDeployPublish
/P:MsDeployServiceUrl=https://%env.TargetServer%/MsDeploy.axd?site=XXXX
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WMSvc
/P:CreatePackageOnPublish=True
/P:DeployIisAppPath=XXXX
/P:UserName=XXXX
/P:Password=XXXX
The pubxml file is as follows (trimmed for space):
<WebPublishMethod>MSDeploy</WebPublishMethod>
<DeployTarget>WebPublish</DeployTarget>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>XXXX</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>XXXX</MSDeployServiceURL>
<DeployIisAppPath>XXXX</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>XXXX</UserName>
<_SavePWD>True</_SavePWD>
Note: I have replaced sensitive information with XXXX
Try setting the Targets
value on the edit build step form to MSDeployPublish. I'm not sure which target Visual Studio will be running locally but my Microsoft.WebSite.Publishing.targets file contains a target named MSDeployPublish.