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?
There are more ways than listed here to deploy web apps. There is very good documentation here that discusses the options for deploying web apps. For example, FTP, Git, Visual Studio, CLI, etc...
From your list though, Web Deploy and MS Deploy (msdeploy.exe) are the same and arguably the most common. Web Deploy is the preferred term though and you will see it used in the tooling. For example, if you right-click an ASP.NET project and select Deploy, Web Deploy is the default option. Again, there are others and the link above explains them.
Publish-AzureWebsiteProject is one of many automated ways to build and/or deploy your web project (ie: the code/app) using PowerShell and it uses the Web Deploy method.
DNU (.NET Development Utility) is used to build, package and deploy DNX (.NET Execution Environment) projects. There's a lot of good information on this here.
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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With