Whenever you install an Ektron CMS 6 site, a Visual Studio solution file is created among the files that make up the site. This solution file is a Website Project (WSP) that lets us work with the Ektron’s source files in the Visual Studio IDE environment.
However a Website Project is not always the best way to work with Ektron so, we might need to convert it into a Web Application Project (WAP). There is a lot of controversy on which of the two project types is better, however based on my experience, I believe that WAPs have certain advantages when it comes to delivering good design, scalable, and robust web applications. Some of the main reasons I prefer using WAPs over WSPs are:
- If you use Continuous Integration on your projects then WAPs are the way to go. I am not saying that WSPs cannot be built from a command line tool like MSBuild, but they will require a little more effort because they do not have a .csproj or .vbproj file.
- You can also use Web.config transformations on your WAP’s. Web.config transformations allow you to change some setting s in the deployed application’s Web.coinfig file. This is generally used to change settings like connections strings, debugging options, etc.
- Microsoft´s Web Deploy technology can only be used on WAPs. Web Deploy (msdeploy) simplifies deployment of Web applications and websites to IIS servers.
- If you use MVC pattern for your web applications, the preferred way to go is WAP.
- Generally speaking it is easier to do unit testing on WAPs that it is to do on WSPs.
Now I’ll show you how to convert the Ektron´s default Website Project into a Web Application Project. To start, we are going to need the default minimal site installation of the Ektroin CMS. If you don’t know how to install it, I recommend you check this tutorial on the Ektron’s developer center.
After installation is complete, you can see the solution file named ‘CMS400Min.sln’ in the folder where you installed the site.
Create a new Visual Studio Web Application Project
To create a Visual Studio Web Application Project for an existing Ektron site follow these simple steps:
- In Visual Studio, click the ‘File’ menu, then click ‘New’, and then click ‘Project’. The ‘New Project’ dialog appears.
- In the ‘Project Types’ tree, expand ‘Visual Basic’, and then click ‘Web’.
- In the ‘Templates’ list, click ‘ASP.NET Web Application’.
- In the ‘Name’ field, enter the name of the project (which is typically the name of the Ektron’s site), for example ‘CMS400WAP’. Visual Studio will use this name as the default .NET namespace and assembly name.
- In the ‘Location’ field, pick a folder where you want to save the project files, for example C:\inetpub\ektron.
- Disable ‘Create directory for solution’.
- Click ‘Ok’ to create the project.
- Once the project is created go into the ‘Solution Explorer’ window, right-click the Default.aspx file and choose ‘Exclude From Project’ from the drop down menu.
- Close the Visual Studio solution.
Move the Web Application Project
To move the Visual Studio project:
- Using the Windows file system explorer, navigate to the directory containing the project files (for example
- Copy the ‘MyProject’ folder, the .sln file, the .vsproj file, and the .vsproj.user file to the root folder of the Ektron site.
Configure the Web Application Project
To be able to use this project file as your Ektron’s development scenario, you’ll need to:
- Include the following folders and files in the solution project. To do this right click in each one and choose ‘Include In Project’ from the drop down menu. (You can select more the one using the
key). If you cannot see these files make sure the ‘Show All Files’ button is pressed.
- Do not include the Workarea folder. If you do, the project will not build successfully.
Following these steps should allow you to convert Ektron’s default Website Project into a Web Application Project, making it possible to take advantage of the items mentioned earlier in this post.