Welcome!

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.

    Conclusion
    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.

    References

  • 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)

    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.


    IoT & Smart Cities Stories
    Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
    René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
    Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
    Whenever a new technology hits the high points of hype, everyone starts talking about it like it will solve all their business problems. Blockchain is one of those technologies. According to Gartner's latest report on the hype cycle of emerging technologies, blockchain has just passed the peak of their hype cycle curve. If you read the news articles about it, one would think it has taken over the technology world. No disruptive technology is without its challenges and potential impediments t...
    If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
    In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
    Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
    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...
    Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
    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...