Search code examples
azuremsdeploymsbuild-taskmsbuild-4.0

The element <publishData> is unrecognized, or not supported in this context


Am using TFS 2017 on-premise for building our code. I have used msbuild task with the following parameters.

/p:DeployOnBuild=true /p:AllowedReferenceRelatedFileExtensions=none /p:PublishProfile="$(Build.SourcesDirectory)\Source\PublishSettings\xxx.azurewebsites.net.publishsettings" /p:VisualStudioVersion=14.0  /p:Configuration=Release

enter image description here

Log:

2017-12-27T07:43:15.6823390Z   Publish Pipeline Deploy phase Stage PipelineCopyAllFilesToOneFolderForMsdeploy
2017-12-27T07:43:15.6823390Z Package:
2017-12-27T07:43:15.6823390Z   Invoking Web Deploy to generate the package with the following settings:
2017-12-27T07:43:15.6979640Z   $(LocalIisVersion) is 0
2017-12-27T07:43:15.6979640Z   $(DestinationIisVersion) is 0
2017-12-27T07:43:15.6979640Z   $(UseIis) is True
2017-12-27T07:43:15.6979640Z   $(IisUrl) is http://localhost:7372/
2017-12-27T07:43:15.6979640Z   $(IncludeIisSettings) is False
2017-12-27T07:43:15.6979640Z   $(_DeploymentUseIis) is False
2017-12-27T07:43:15.6979640Z   $(DestinationUseIis) is False
2017-12-27T07:43:15.6979640Z GetMSDeployInstalledVersionPath:
2017-12-27T07:43:15.6979640Z   $(_DefaultMSDeployMaxVersion) is 3
2017-12-27T07:43:15.6979640Z   $(_MSDeployVersionsToTry) is 9.0
2017-12-27T07:43:15.6979640Z   $(MSDeployPath) is C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\
2017-12-27T07:43:15.6979640Z GenerateMsdeployManifestFiles:
2017-12-27T07:43:15.6979640Z   Generate source manifest file for Web Deploy package/publish ...

I got the below error.

The element <publishData> is unrecognized, or not supported in this context

I tested my publish setting which is downloaded from azure, it works perfectly fine with the visual studio deployment. My web api project is of .Net 4.6.1 .

Note: Only this project is not building properly, all other project of .Net 4.5.1 builds, perfectly fine in our on-premise tfs agent.


Solution

  • I used the wpp files in my working project and now used the same wpp files in the new azure function project and it is all working now. What it really does is, it xmlpeeks your publishsettings and makes a publish profile on the fly at msbuild runtime. You can find more details on implementations @ http://sedodream.com/2013/06/05/HowToPublishAVSWebProjectWithAPublishSettingsFile.aspx