Search code examples
azureazure-web-app-serviceasp.net-coremsdeploywebdeploy

MSDeploy vs WebDeploy vs Publish-AzureWebsiteProject vs dnu publish


When learning about how to publish our ASP.NET 5 application to an Azure Web App, I came across several ways of publishing .NET web applications:

  • MSDeploy
  • WebDeploy
  • Publish-AzureWebsiteProject
  • dnu publish

Information on the Internet regarding this is quite scattered and I cannot wrap my head around what these different "techniques" are intended for.

What are the main differences between them and when should/could they be used?


Solution

  • MSDeploy vs Web Deploy

    Regarding MSDeploy vs Web Deploy, as Rick mentioned they are the same thing. The actual name is "Web Deploy" but the .exe is named msdeploy.exe so that's why both names are used.

    DNU Publish

    dnu publish is a cross platform utility provided by DNX/ASP.NET 5 which can be used to publish a DNX/ASP.NET 5 app to a folder.

    Let me explain how that relates to the support you see in Visual Studio 2015. In VS2015 the primary responsibility of the publish dialog is to persist settings in the publish profile (.pubxml file). Visual Studio first calls dnu publish to publish the app to a local folder. Then the properties (all of them, even custom ones you add) are passed to the profilename.ps1 file as the -publishProperties parameter. The path to the folder where the results of dnu publish are at is passed in via -packOutput. At that point control is transferred to the .ps1 file, VS has no knowledge of the actual publish internals. You can gut the contents of the .ps1 and as long as the parameters remain the same it should work.

    The PowerShell script, and the module that it consumes,are OSS at https://github.com/aspnet/vsweb-publish. The default script created by VS is at https://github.com/aspnet/vsweb-publish/blob/master/samples/default-publish.ps1. Note: this module currently only works for ASP.NET 5. If you're interested for previous versions let me know and we can consider adding support.

    If you're interested in learning more about that script I recommend get-help Publish-AspNet after the publish module is loaded. Or you can check the help text in the source.

    Publish-AzureWebsiteProject

    Publish-AzureWebsiteProject is a PowerShell cmdlet shipped with the Azure PowerShell command line tools. You can use this to publish and ASP.NET 4.5 project or package to Azure Web Apps (formerly named Azure Websites). I do not believe that this has been updated to support ASP.NET 5, but I could be wrong there.