Microsoft Cloud Authors: Nick Basinger, Kevin Benedict, Pat Romanski, Liz McMillan, Lori MacVittie

Related Topics: Microsoft Cloud

Microsoft Cloud: Article

Team Development with Visual Studio .NET on a Shared Server

Team Development with Visual Studio .NET on a Shared Server

Anyone who has created a Web project using Visual Studio .NET 2002 is aware that VS.NET ties the location of the Web project to a virtual directory on Internet Information Server (IIS). The name of the project folder must be identical to the name of this virtual directory so that the project can be accessed from http://localhost/<projectname>. This strict mapping between the project folder name and virtual directory name has some undesirable consequences, as we shall see, especially when multiple developers are sharing a .NET development server (e.g., by connecting remotely through Terminal Services).

For example, we have established a shared development server running Windows 2000 Server with Sharepoint Portal Server 2001, which allows our developers to independently develop, test, and integrate code into our Web application by connecting remotely through Terminal Services. Our security is integrated with Active Directory. Developers log on to the Windows 2000 Server and develop their code directly on the server. As part of the development life cycle, we needed the ability to have our team members develop, integrate, and maintain individual parts of the application. This means that one developer may need to check out, modify, and test a part of the application that was originally created by another developer.

In such a shared development environment, we needed the ability to separate the various developers' source trees and allow them to test their individual code using http://localhost/<projectname>. However, since every Web project in VS.NET must map to a virtual directory with the same name, it was not possible for us to separate developer source trees without giving up the use of VS.NET. We had to find another way to set up our projects if we wanted to continue to use VS.NET for development and debugging.

We also found another problem with using the Web project approach. Since each Web project in VS.NET is an IIS application with a virtual root, and since virtual roots are not allowed to share application state, this means that VS.NET Web projects cannot share the same session. If we wanted to have projects share session information, we would have to lump all our code into one big VS.NET Web project, which was unacceptable. We wanted the ability to create multiple projects supporting discrete functionalities, and contain them in one VS.NET solution. For example, UI-related code could be placed in a project called ui; database-related code could be placed in a project called db; etc. This facilitates component-based development and deployment. Surprisingly, VS.NET does not directly support multiproject Web applications.

This article presents a solution to these two problems, offering:
1.   The ability to support multiple developers using VS.NET for developing Web applications on the same server
2.   The ability to create multiproject Web applications using VS.NET while sharing the same IIS virtual root, hence sharing the same session state.

Both problems can be solved quite elegantly using the same development approach. Note that wherever we use the term "Web project," we refer to any of the various Web projects that can be developed with VS.NET, like ASP.NET Web Application project, ASP.NET Web Service project, and Empty Web project.

A More Flexible Approach
VS.NET undoubtedly offers a great environment for .NET development. It provides rich features like IntelliSense, and does some of the plumbing for you so you can be more productive. However, you can very well develop your .NET applications without it. You must realize that whether you create your VS.NET project as a Web project or as a Windows application or as a Class Library, the resulting underlying code structure is almost the same, with only minor plumbing differences. So the choice of the project type is mostly superficial.

For example, if you create your VS.NET Web project not as an ASP.NET Web Application, but as a C# Class Library (or a VB Class Library if you are a VB developer), VS.NET does not enforce the virtual directory binding. This gives you great freedom while creating a virtual directory mapping to the VS.NET project folder. You can use this to your advantage while solving the two problems.

First let's create two projects using this approach. Assume two developers, developerA and developerB, will be working on a VS.NET solution containing multiple projects. Only one developer needs to set up the project structure initially. Other developers can simply use the source tree created by the first developer. Let's say developerA sets up the projects initially, as follows:
1.   On the File menu, click New, and then click Project. The New Project dialog box appears as shown in Figure 1.
2.   In the Project Types pane, click Visual C# Projects, and in the Templates pane, select Class Library.
3.   Give a name to the project, e.g., project1, and set the location to c:\developerA\dotnetapp.
4.   Click OK.
5.   Add ".aspx" and other files to the project.
6.   Optionally, add Web.config and Global.asax files to the project. If needed, copy these files from another project and then make the appropriate changes.
7.   Repeat steps 1-6 to create project2 and project3.
8.   Create a blank solution in c:\developerA folder. Name this solution dotnetapp. This should create a file called dotnetapp.sln in c:\developerA\dotnetapp.
9.   Add the three projects (project1, project2, project3) to this solution.

Create a virtual directory on IIS called A_dotnetapp and point it to c:\developerA\dotnetapp, which is the folder for the VS.NET solution. Now developerA can test the code in project<n> using http://localhost/A_dotnetapp/project<n>/. This URL now points to c:\developerA\dotnetapp\project<n> folder.

Once developerA checks in his code (say into a Visual SourceSafe database), developerB can check it out into another folder called c:\developerB\dotnetapp. DeveloperB can then create an IIS virtual directory called B_dotnetapp pointing to c:\developerB\dotnetapp, and test his projects using http://localhost/B_dotnetapp/project<n>/. This URL now points to c:\developerB\dotnetapp\project<n> folder. This way, each developer can maintain his or her own version of the VS.NET solution in a separate folder (in this case bearing the same name as the developer), with an IIS virtual directory mapped to this folder (see Figure 2).

During deployment, create a virtual directory called dotnetapp, and map it to c:\<deploymentfolder>\dotnetapp so that the VS.NET solution is accessible from http://<servername>/dotnetapp/. In this way the solution name and the project names always remain the same for all developers, and it is only the virtual directory names and their mappings that need to be configured.

Figure 3 compares the Web project approach with the Class Library (non-Web) project approach. With the Web project approach, every project folder is a virtual root, whereas with the Class Library approach, only the VS.NET solution folder needs to be made a virtual root. In the latter approach, since the project folders are within the same IIS virtual root, they are able to share session information using the in-process session mode.

Now you can start developing your projects as usual, as long as you're aware of the differences between the two approaches (see Table 1)

Following are some similarities between the two approaches that are probably most relevant for a developer.

  • Developers can continue to use the ASP.NET Web Forms Designer tool in the usual manner.
  • Every subdirectory of the VS.NET solution can still have its own Web.config file. Each Web.config file applies configuration settings to its own directory and to all subdirectories below it using the inherited Web.config model.

    Benefits of This Approach
    We have found that the above approach offers an extremely flexible development model, especially for multiple developers sharing the same .NET development server by connecting remotely. Following is the list of some of the benefits we noticed.

  • By defining multiple IIS virtual roots, developers can work on multiple versions of a Web application, where each virtual root maps to one version of the Web application.
  • A direct benefit of using the above approach is that you can mimic a production environment more closely during development. We actually have a "production" image of our application deployed on our development server, where the production image is produced from our automated builds. A separate production virtual directory has been created that maps to the production image.
  • The Class Library approach allows you to create a set of projects contained in a VS.NET solution without having to create a virtual directory for each project, hence all projects are able to share session information.
  • You can easily integrate multiple projects into a single Web application.

    As the .NET development community grows, we are certain there will be teams wanting to develop in a shared environment like ours. We hope they will find this approach useful for their development efforts.


  • Team Development Guide for Visual Studio .NET: www.microsoft.com/downloads/details.aspx? displaylang=en&FamilyID=94FDB8C8-5A87-4545-AF75-6053F32C7ECA
  • HOW TO: Create an ASP.NET Application from Multiple Projects for Team Development, Microsoft Knowledge Base Article 307467: http://support.microsoft.com/ default.aspx?scid=kb;en-us;307467
  • ASP.NET Session State, MSDN Library: http://msdn.microsoft.com/library/en-us/ dnaspnet/html/asp12282000.asp
  • More Stories By Amit Goel

    Amit Goel has been developing object-oriented applications for several years using Java, C++, and recently C#. He holds a master's degree in computer science from Virginia Tech. You can learn more about him at www.amitgoel.com.

    Comments (1) View Comments

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

    Most Recent Comments
    06/19/03 05:52:00 PM EDT

    Use a good Source Code Control provider like Telelogics Synergy. All developers can develop locally (faster) and you don't have to worry about stepping on each other.

    IoT & Smart Cities Stories
    CloudEXPO | DevOpsSUMMIT | DXWorldEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
    All in Mobile is a place where we continually maximize their impact by fostering understanding, empathy, insights, creativity and joy. They believe that a truly useful and desirable mobile app doesn't need the brightest idea or the most advanced technology. A great product begins with understanding people. It's easy to think that customers will love your app, but can you justify it? They make sure your final app is something that users truly want and need. The only way to do this is by ...
    Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
    DXWorldEXPO LLC announced today that Big Data Federation to Exhibit at the 22nd International CloudEXPO, colocated with DevOpsSUMMIT and DXWorldEXPO, November 12-13, 2018 in New York City. Big Data Federation, Inc. develops and applies artificial intelligence to predict financial and economic events that matter. The company uncovers patterns and precise drivers of performance and outcomes with the aid of machine-learning algorithms, big data, and fundamental analysis. Their products are deployed...
    Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
    The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...
    Cell networks have the advantage of long-range communications, reaching an estimated 90% of the world. But cell networks such as 2G, 3G and LTE consume lots of power and were designed for connecting people. They are not optimized for low- or battery-powered devices or for IoT applications with infrequently transmitted data. Cell IoT modules that support narrow-band IoT and 4G cell networks will enable cell connectivity, device management, and app enablement for low-power wide-area network IoT. B...
    The hierarchical architecture that distributes "compute" within the network specially at the edge can enable new services by harnessing emerging technologies. But Edge-Compute comes at increased cost that needs to be managed and potentially augmented by creative architecture solutions as there will always a catching-up with the capacity demands. Processing power in smartphones has enhanced YoY and there is increasingly spare compute capacity that can be potentially pooled. Uber has successfully ...
    SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
    When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...