Click here to Skip to main content
15,880,405 members
Articles / Web Development / IIS
Article

Separating an ASP.NET Web Application into multiple Web Projects (Assemblies)

Rate me:
Please Sign up or sign in to vote.
1.83/5 (11 votes)
29 Aug 20042 min read 65.7K   980   33   5
This article outlines how to separate an ASP.NET Web Application into multiple Web Projects (Assemblies).

Introduction

Sometimes, when a Web project is large and complicated, it is difficult to manage it as a single unit. Every small change in code requires recompiling of the whole unit and doing that is not so efficient. The solution is to separate a large Web project into multiple child projects and reference them from the main project. In this article, I will show how to implement this method.

Solution

Solution Explorer

First, let's create the main ASP.NET project in Visual Studio .NET. I will call it MainWeb. Then I will add two child projects:

  1. Child1 – C# ASP.NET project.
  2. Child2VB – VB.NET ASP.NET project.

In the location box of Add New Project dialog, we will type http://localhost/MainWeb/Child1 for Child1 and http://localhost/MainWeb/Child2VB for Child2VB.

The next step will be removing of global.asax and web.config from both child projects and reference them from the MainWeb project.

We almost have done. Now, we need to remove Child1 and ChildVB2 virtual directories from IIS.

That’s all.

Conclusion

Implementing this method on your projects has several advantages:

  • You will be able to write several parts of your Web project in different languages (C#, VB.NET…).
  • Doing some changes in code will not cause to recompiling of the whole assembly.
  • You will be able to separate a large project into logical units that will share common resources.
  • It is easier to maintain a small logical unit than a large one.

The disadvantages:

  • Visual Studio doesn’t support this method directly, so you have to make all these steps by your own.
  • Assemblies that access each other's resources must set references to each other. Visual Studio .NET does not allow circular references.
  • This solution is good only for large projects. Implementing this method on small Web applications is complex additional work.

This article is based on

How To Create an ASP.NET Application from Multiple Projects for Team Development.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionok button disabled Pin
avinashkumar05093-Apr-17 21:23
avinashkumar05093-Apr-17 21:23 
GeneralUsing Web.config from child projects Pin
AndrusM3-Jun-09 8:55
AndrusM3-Jun-09 8:55 
QuestionHow do we do this in ASP 2.0 Pin
Karijn14-Oct-05 1:24
Karijn14-Oct-05 1:24 
GeneralThanks for the article Pin
NSPatel3828-Aug-05 7:40
NSPatel3828-Aug-05 7:40 
GeneralAuthentication Pin
Eric Newton6-Nov-04 10:08
Eric Newton6-Nov-04 10:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.