I'm attempting to update a deployment process for a .NET Framework site to an Azure WebApp. We were previously using the Publish-AzureWebsiteProject PowerShell cmdlet but it's being phased out. So we're attempting to use kudu's zipdeploy functionality via the recently released Publish-AzWebApp PowerShell cmdlet. Everything's working great as far as getting the files to Azure, but failing horribly in unpacking the ZIP into to the correct location.
When I build the site using the "Package" target on our build server it produces a ZIP structured for use with MSDeploy. This is not the format expected by the zipdeploy method. The MSDeploy ZIP file includes deployment XML, and the actual content is deep-nested into a path representing the original location. Zipdeploy appears to want a simple archive of the web site's content root and so it's copying the files from the archive into the literal path after extraction.
So, for example, if my Visual Studio solution is in d:\builds\solution then the build files for packaging are put in d:\builds\solution\project\obj\debug\Package\PackageTemp. The content of the site goes into the ZIP under the following path D_C\builds\solution\project\obj\debug\Package\PackageTemp\Content. As a result, when zipdeploy runs it's putting the content into the webapp at wwwroot/Content/D_C/builds/solution/project/obj/debug/Package/PackageTemp/Content/.
The command I'm running to build the project is:
msbuild.exe /nologo /v:minimal /T:Package /p:Configuration="Debug;VisualStudioVersion=12.0" project.csproj
I'm hoping somebody knows how I can achieve this with one of the following (preferential order):
- a msbuild argument to build the site and create a simple content ZIP
- a kudu setting that will deploy the current ZIP using msdeploy instead of straight copy
- a custom kudu deployment script that will deploy via msdeploy instead of file copy
- a msbuild target customization that will create a compatible ZIP