Web development with Visual Studio and Plastic SCM

Web applications development is one of the most usual activities carried out by most software companies using Visual Studio. The IDE version 2005 introduced numerous improvements allowing working with this kind of applications. These improvements make working with Web applications more similar to conventional Windows applications. When it's about web development it is also essential to introduce parallel development and in order to do this the first step is to have a version control system to manage changes. This article will explain different solutions, as well as the right way of configuring Visual Studio to use it together with a version control system on web projects.

Deployment configurations of web development and version control systems

Although developing web applications with Visual Studio is quite similar to conventional applications development, there are some special features that impose certain constraints that should be taken into account. Visual Studio supports the following three working modes for version control on web projects:

Isolated Development

This mode is the one that better adjusts to working with a version control and the one recommended by Microsoft. Each developer has his own web server (IIS) installed locally to enable executing and debugging applications. Code modifications are done on a local copy which works against the centralized version control. This is the usual working mode when using a version control.

ISolated_Dev

Semi-isolated Development

Microsoft does not recommend to use this method if you pretend to work with a version control system. There is only one centralized server which will execute and debug the web application. This server will also host every source control copy. Workspaces will be placed on a remote machine and will be shared through net units or UNC paths. This working mode is no longer supported by Visual Studio 2005 and newer versions even though it was available on the 2003 version.

Semi_isolated_dev

Non-isolated Development

Microsoft does not recommend to use this mode but it is still used by many companies. There is only one web server configured to execute and debug web applications. Developers usually work from the server's FrontPage extensions. Programmers cannot work isolated with this type of development. Practically no version control supports this working mode.

Working with Plastic SCM and Visual Studio

In order to work with Visual Studio and Plastic SCM the isolated development working mode is mandatory. This way parallel development is possible, which are great news for users. The only disadvantage on isolated development is that the debugging and testing environment used by the developer is quite different from a real production system. Developers' computers are usually less powerful than the server where the real system will be actually executed, and they also have a different software configuration.

Nevertheless, the benefit of being able to make parallel changes and not being constrained to debug only a user at a time (as the other modes do, since there is only one web server) far out weights the possible disadvantages. Anyway, it is possible to sort out this limitation introducing a testing or preproduction server on which the application can be installed and tested.

Creating a web Project associated to Plastic SCM with Visual Studio

The steps to create a new Project and associate it to Plastic SCM are described below. It is important to apply the following instructions on the indicated order:

  1. Create a workspace in c:\Inetpub\wwwroot (the folder where the IIS server is located).
  2. Create a blank solution in this folder or in any subfolder.
  3. Add Web projects to the solution.
    • File / New / Web Application / ASP.NET
    • Select as path http://localhost/Project
  4. Add the solution to Plastic SCM.

The recommended directory structure to achieve the best performance under a version control is shown below:

Required structure

Opening the Project for the first time with Visual Studio

We'll focus on 2005 version and newer versions. Also, we'll assume that Plastic SCM and the Visual Studio Package are installed on the computer.

  1. Open Visual Studio 2005.
  2. Select File / Open from Plastic SCM
  3. Select a workspace or create a new one.
  4. Select the solution's folder you want to open and click on OK.
Open from Plastic

Isolated development model without IIS installed

It is not necessary to have IIS installed from the 2005 version of Visual Studio on. When debugging and executing, Visual Studio will use a small local web server. In order to work with Plastic SCM and the source code folders located on the local folder system, you have to:

  1. Open Visual Studio 2005.
  2. Create a blank solution on the user's workspace.
  3. Add the new web project to the solution.
  4. Add the solution to the source control.
Add to source control

IMPORTANT: If a blank solution is not created on the first place and it is directly created on the web site, Visual Studio will automatically create a solution and place it in "My Documents\Visual Studio 200x\Projects\Project Name\", within the user's local folder. This means that the solution folder will not be included on the source control.

Moving a web project to another computer

Before adding the code to Plastic SCM's control, sometimes it's necessary to move the web Project source code from one computer to another. Once the project is under Plastic SCM control it's not necessary to do this operation again, because you can use the "Open from Plastic SCM" operation as explained above.

To move the source code from one machine to another:

  1. First copy the source code from the original location to the new one.
  2. Create a new IIS virtual directory on the destination computer pointing to the folder where the Project is located (this is ok if the original project is working against 'localhost'; for remote projects the solution file should be manually modified
  3. Adjust the new web application permissions.
  4. Open the Project with Visual Studio and adjust the starting options if necessary.

Operation notes

To work properly with an IIS installed on the local machine, the user should:

  1. Be a member of the machine' administrators team, in order to access IIS metadata or configure the access rules from the IIS.
  2. Be a member of the debugging users' group in order to debug Web applications.
  3. The web application should have activated the "use Windows integrated authentication" box on the directory security tab.
Directories_examples
Win_Integ_auth

Known issues

c:\ is not on a workspace

This problem arises when a web Project is created without having previously created a blank solution. When an empty web Project is created, Visual Studio places the solution's folder on the local user's path, as explained before. When you try to add this folder, every parent folder going down from c:\ is attempted to be added to Plastic SCM, and if they are not on a workspace, an error will be notified. To solve this issue:

  1. Create a blank solution located on the shared folder inside the user's workspace.
  2. Add the new web Project to the blank solution.

References