Using the Visual Studio 2005 Web Application Project with MCMS SP2
Updated: January 9th 2006.
Introduction
With the recent release of Service Pack 2 for MCMS, it is now possible to
develop MCMS applications using Visual Studio 2005. Visual Studio 2005 offers a
vastly enhanced design time experience and significantly reduces the time to
develop solutions. One of the most useful aspects of Visual Studio 2005 for MCMS
developers is the improved design time Web designer, which amongst a myriad of
new features includes superb support for HTML validation. However with Service
Pack 2 MCMS Applications are developed using the new 'Web Site' Visual Studio
project type, which has a number of MCMS integration issues and causes an
undesirable design time experience for developers.
This article details an approach to using the Visual Studio 2005 Web
Application Project to avoid problems associated with the 'CMS' Virtual
Directory and the default Item Templates.
Issues with MCMS SP2 and the Visual Studio 2005 Web Site Project Model
With Visual Studio 2005 comes a new project model for Web Applications called
Web Sites. This new model does away with project files and provides the ability
to connect to a variety of end points. This new model provides many benefits for
ASP.NET development, and is the project model supported by MCMS Service Pack 2.
However, this model causes an undesirable experience for MCMS development due
primarily to the requirement for the MCMS 'CMS' Virtual Directory (a.k.a Web
Author) to be configured as an Alias within IIS.When creating a new MCMS Web
Application using Visual Studio 2005, the wizard will create the 'CMS' Virtual
Directory in IIS. It doesn't appear in the Solution Explorer until the Refresh
button is clicked, or the project is closed and reloaded. Once it does appear,
however it is considered part of the Web Site by Visual Studio. This means that
the Web Author files are included in the build of the Web Site. This causes three main
issues for MCMS developers:
- Web Author files are included in pre-build validation.
If Include Accessibility Validation is selected in Build Options,
the Web Author files are validated and fail pretty badly! The Web Site won't
build until all 14 errors (in the default Web Author files) are corrected or
Accessibility Validation is disabled.
- The Web Author files are easily accessible and can be modified in
Visual Studio.
Whilst the files are read only by default, hitting Save followed by
Overwrite will make changes to files that Microsoft say you should never
touch and won't support your deployment if you do (even if you are fixing
the above accessibility issues!).
- Any additional files in the 'CMS' path with be included in the build
and possibly cause the build to fail.
If you have installed additional files for the Web Author, or are using
support files for the excellent Telerik r.a.d Editor or MCMS Controls Suite,
these files will be included in a build, even though you don't want these
files to be built!
Because the Web Author has
to be an Alias, there is no easy means to exclude it from the build. One
potential workaround is to make the Web Author an Application within IIS, build
the Web Site and then revert the Web Author back to an alias. This is messy and
makes the debug experience painful. Another potential option is to use the Exclude From
Project option, but this renames the files with a .exclude extension (which
will break the Web Author) and every file (301 by default) has to be excluded
manually.
Some of these problems and others are also faced by ASP.NET developers and
those who are generally unhappy with the new Web Site project model. This has
prompted the Web Tools team to produce the Visual Studio 2005 Web
Application Project, which can also provide a solution for MCMS developers.
Note: The Visual Studio 2005 Web Application Project is currently in Beta
and expected to ship this Spring.
Creating MCMS Applications with the Visual Studio 2005 Web
Application Project.
After downloading and installing the Visual Studio 2005 Web Application Project
you will have a new project type, ASP.NET Web Application which is available
under the language specific project type of your choosing. Follow the steps
below to use it with MCMS Service Pack 2.
- Create a new MCMS Web Site.
- From the File menu, click New, followed by New Web
Site...
- Select the MCMS Web Application icon and enter
MCMS_VS_Support in the Name text box and click OK.
Note: This is simply a mechanism to get the MCMS Template Explorer
active in Visual Studio.
- Add a new ASP.NET Web Application to the solution.
- From the File menu, click Add, followed by Project.
- In the New Project dialog, click the ASP.NET Web
Application icon, and enter a name in the Name textbox. Click
OK.
- The project will be created and opened in Visual Studio 2005.
- Add the required MCMS references and files.
- In the Solution Explorer, right click the project created in step
two followed by Set As Start Up Project.
- In the Solution Explorer, right click the References folder
for the project created in step two,
followed by Add Reference...
- In the Add Reference dialog, click the Browse tab.
- In the Look in combo box, navigate to
c:\Program Files\Microsoft Content Management Server\Server\bin.
- Select the following assemblies:
Microsoft.Content.Management.Common.dll
Microsoft.Content.Management.Publishing.dll
Microsoft.Content.Management.Publishing.Extensions.Placeholders.dll
Microsoft.Content.Management.Publishing.Extensions.Placeholders.Office.dll
Microsoft.Content.Management.Web.dll
Microsoft.Content.Management.WebAuthor.dll
Microsoft.Content.Management.WebControls.dll
- Click OK.
- In the Solution Explorer, right click the References folder
for the project created in step two,
followed by Add Reference...
- In the Add Reference dialog, click the Browse tab.
- In the Look in combo box, navigate to
c:\Program Files\Microsoft Internet Explorer WebControls.
- Select the Microsoft.Web.UI.Controls.dll assembly and click OK.
- Drag and drop the Console folder in the MCMS_VS_Support
Web Site to the Project created in step two.
- Drag and drop the web.config file in the MCMS_VS_Support
Web Site to the Project created in step two.
- Click Yes when prompted by the Destination File Exists
dialog.
- Right click the default.aspx file, followed by Delete
and OK.
- Configure IIS.
- Open Internet Information Services and create a new Virtual Directory
for the project created in step two above.
- Create the 'CMS' alias under the Virtual Directory just created.
(ensure that the the application has Windows Authentication enabled, and
the alias has Anonymous enabled.)
- Configure Project Properties.
- Right click the project created in step two, and click Properties.
- Click the Web tab.
- Select the Use IIS Web Server radio button, and enter the URL to
the Virtual Directory created in step four in the Url text box.
- Save your project.
You can now develop your MCMS applications without any of the WebAuthor
associated problems!
Click here to download a project template for the
above solution.
Known Problems with this Solution.
Because this solution does not address the MCMS Template Explorer
window adequetly there is the requirement to browse for the Template Gallery
Item's Template File as the Template Explorer opens in the Virtual Directory
associated with the MCMS_VS_Support application. In addition, this beta
release of the Visual Studio 2005 Web Application Project does not support
Design mode drag and drop for User Controls.
|