Someday, somehow, for some reason, you may end up in the same situation I found myself a few weeks ago. “Guys, we need to create a WDP for our module. How long it will take?“.
But wait, what the hell is a WDP? And why is it that important? How hard is to create one? Who am I? What am I even doing here? You may start asking yourself those questions until you realize how easy this task can be.
I’m here to help you and share what we figured out during our investigation.
What is a WDP package?
A Web Deploy Package is a zip file which may contain application code, resources and Sitecore items that represents the instance or module that you want to package. It’s that simple, just like a normal Sitecore package.
The major difference here is that the installation of a WDP can be easily scripted using AzureToolkit and msdeploy. That’s pretty handy when you are automating your environments creation and don’t want to use the Installation Wizard to install your modules, for instance.
If you look closely to the name of your Sitecore 9.x packages you will realize they have a scwdp.zip extensions. SCWDP = Sitecore WDP.
Since one can use AzureToolkit to create a script which installs a WDP + the fact that Sitecore is betting strongly in Azure, it’s our duty to know what it is and how to manipulate it.
In order to be able to create your WDP you will need:
- The original Sitecore package you want to convert to a WDP. This can be done easily using the Package Designer feature from Sitecore if you don’t have one.
- Download the AzureToolkit from Sitecore.
- Powershell 4.x or newer ($PSVersionTable.PSVersion to check your current version)
- Download and install MSDeploy.
- Microsoft SQL Server Data-Tier Application Framework (DacFX) for SQL server 2012 or later.
Is it hard to create one?
If you are already using TDS you can use it to create your WPD.
We are not using it (and many of you may be in the same situation) so we had to figure out how to create a WDP without the help of any external tool. And guess what? After all, it’s pretty straightforward and should only take a few minutes.
What a Sitecore developer does when he needs to create a script for something? He opens the Windows PowerShell prompt. And that’s exactly what I will ask you to do since we are going to use it in this task.
Firstly, let’s start by importing the methods we need from the downloaded AzureToolkit:
Import-Module “AzureToolkitFolderPath\tools\Sitecore.Cloud.Cmdlets.dll” -Verbose
And then, we can properly convert your previously created Sitecore package into your brand new WDP package:
ConvertTo-SCModuleWebDeployPackage -Path “yourPackagePath.zip” -Destination “wdpOutputDirectoryPath“ -force -verbose
After a while (and it should not take that long) you will see your first scwdp.zip file on the output folder specified on the last command.
I know by experience that the first contact with the WDP world it’s never that easy, but once you realize how simple and useful it is everything starts making sense.
This is only the first blog post of a series about WDP on which I’ll explain to what exactly a WDP package contains, how to deploy it on Azure and even how to deploy it on an on-premises instance (always handy when you want to test a few things locally). See you all soon!