{"id":5404,"date":"2006-06-30T20:51:00","date_gmt":"2006-06-30T20:51:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2006\/06\/30\/part-1-of-3-creating-sub-projects-in-iis-with-web-application-projects\/"},"modified":"2006-06-30T20:51:00","modified_gmt":"2006-06-30T20:51:00","slug":"part-1-of-3-creating-sub-projects-in-iis-with-web-application-projects","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/part-1-of-3-creating-sub-projects-in-iis-with-web-application-projects\/","title":{"rendered":"Part 1 of 3: Creating sub-projects in IIS with Web Application Projects"},"content":{"rendered":"<p><DIV class=\"Section1\">\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>First a quick intro, since this my first post on the team blog.&nbsp; My name is Omar Khan.&nbsp; I&#8217;m the group program manager for the web development tools team.&nbsp; I manage the program management team that helps design the web tools inside of Visual Studio.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>This post is one of a three part series that describes how to factor development of a single large ASP.NET application into multiple projects inside of Visual Studio 2005 using the Web Application Projects add-in.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>Part 1 of 3: In this post, I\u2019ll describe the basics on how to setup a sub-project structure using IIS.<\/SPAN><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>Part 2 of 3: The next post will describe intricacies with master pages, user controls, and project references when using a sub-project structure.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>Part 3 of 3: The final part to the series will describe how to use the same technique but with the built-in development server in Visual Studio 2005.<\/SPAN><\/P>\n<H2><FONT size=\"4\">Why use sub-projects?<\/FONT><\/H2>\n<P class=\"MsoNormal\"><SPAN>With very large web applications, such as those that contain thousands of files, using a sub-project structure in Visual Studio provides several benefits.<\/SPAN><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>At development time, it provides a clean isolation between different parts of the application.<SPAN>&nbsp; <\/SPAN>This enables different developers to own their own projects within a single web application, and allows them to make changes without affecting code that is in a different project.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>As well, using sub-projects provides a clean way to compartmentalize functionality so different parts of the application can be developed in isolation from others.<SPAN>&nbsp; <\/SPAN>The compartmentalization also enables the ability to deploy the various sub-projects to production independently from each other thus providing more flexibility around incremental updates to one part of the application without affecting other parts.<SPAN>&nbsp; <\/SPAN><\/SPAN><\/P>\n<H2><FONT size=\"4\">Setting up the root project using IIS<\/FONT><\/H2>\n<P class=\"MsoNormal\"><SPAN>The first thing I want to show is a step-by-step on how to setup a sub-project project structure based on developing on IIS.<\/SPAN><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>Setting up a sub-project structure in Visual Studio 2005 is fairly straightforward.<SPAN>&nbsp; <\/SPAN>If one has done it in Visual Studio 2003, the process described below should be very familiar.<SPAN>&nbsp; <\/SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>Here is a step-by-step walkthrough of how to setup sub-projects using Visual Studio 2005 and the Web Application Projects add-in.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><SPAN>1)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>Download and install \u201cWeb Application Projects\u201d add-in.<SPAN>&nbsp; <\/SPAN>The add-in can be installed from the following location: <A href=\"http:\/\/msdn.microsoft.com\/asp.net\/reference\/infrastructure\/wap\/default.aspx\">http:\/\/msdn.microsoft.com\/asp.net\/reference\/infrastructure\/wap\/default.aspx<\/A><\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><SPAN>2)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>Create the root project.<SPAN>&nbsp; <\/SPAN>The first thing we want to do is create a new Web Application project that will represent the root of the application in IIS.<SPAN>&nbsp; <\/SPAN>To do this select File &gt; New Project.<SPAN>&nbsp; <\/SPAN>Choose the ASP.NET Web Application item, and type in a name and location for the root project.<SPAN>&nbsp; <\/SPAN>In this example we\u2019ll call the root project <I>MyLargeWebApp<\/I>.<SPAN>&nbsp; <\/SPAN>Make sure the \u201cCreate directory for solution\u201d checkbox is unchecked.<SPAN>&nbsp; <\/SPAN>One can create the \u201cRoot\u201d project in a folder in the \u201cinetpub\/wwwroot\u201d directory for IIS, or in any other location where you wish to create the virtual root for your app.<SPAN>&nbsp; <\/SPAN>In this example, we\u2019ll use a location underneath \u201cinetpub\/wwwroot\u201d.<SPAN>&nbsp; <\/SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN><\/SPAN><\/SPAN>&nbsp;<\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image001.png\" border=\"0\"><\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><SPAN>3)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>The next step is to map the <I>MyLargeWebApp<\/I> project in IIS using the \u201cWeb\u201d tab in project properties.<SPAN>&nbsp; <\/SPAN>To do this, right-click on the root node of the project and select \u201cProperties\u201d.<SPAN>&nbsp; <\/SPAN>Click the \u201cWeb\u201d tab on the page that is launched, and select the \u201cUse IIS Web Server\u201d option.<\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image003.png\" border=\"0\"><\/SPAN>&nbsp;<\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN>4)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>Next you need to create a virtual directory mapping in IIS to point to the location where your root project exists.<SPAN>&nbsp; <\/SPAN>To do this click the \u201cCreate Virtual Directory\u201d button on the same Properties page.<\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image005.png\" border=\"0\"><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN>5)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>You can now test your root project, by adding some content to default.aspx and selecting F5.<SPAN>&nbsp; <\/SPAN>This should run launch IE and the default.aspx page will get served from IIS.<\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image007.png\" border=\"0\"><\/SPAN><\/P><\/BLOCKQUOTE>\n<H2><FONT size=\"4\">Creating sub-projects under a root project<\/FONT><\/H2>\n<P class=\"MsoNormal\"><SPAN>Once the root project is up and running fine, the next step is to create a sub-project and set it up so it builds and runs as part of the same ASP.NET application represented by the root project.<SPAN>&nbsp; <\/SPAN>The following steps describe how to do this:<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN>1)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>The first thing&nbsp;you need to do is add a new Web Application project to the same solution.<SPAN>&nbsp; <\/SPAN>Make sure the MyLargeWebApp solution\/project is already open in the solution explorer.<SPAN>&nbsp; <\/SPAN>To add a new project to the solution, select \u201cFile &gt; Add &gt; New Project\u201d.<SPAN>&nbsp; <\/SPAN>Select \u201cASP.NET Web Application\u201d as the template.<SPAN>&nbsp; <\/SPAN>Then type in a name for the sub-project (\u201cSubProject1\u201d in this example), and set it to the location of the folder where the root project is (c:\\inetpub\\wwwroot\\MyLargeWebApp in this example).<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN>&nbsp;<\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\" dir=\"ltr\"><SPAN>&nbsp;<IMG height=\"384\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image009.png\" width=\"595\" border=\"0\"><\/SPAN><\/P>\n<P class=\"MsoNormal\" dir=\"ltr\"><SPAN><\/SPAN>&nbsp;<\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><SPAN>2)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>You should now have two projects in your solution which represent a single ASP.NET application.<SPAN>&nbsp; <\/SPAN>To verify this, go to the IIS management console by selecting Start &gt; Run &gt; inetmgr in Windows.<SPAN>&nbsp; <\/SPAN>In the management console, you should see a \u201cSubProject1\u201d folder under single IIS web application called \u201cMyLargeWebApp\u201d.<\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image011.png\" border=\"0\"><\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN>3)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>To get the sub project building and running a few more steps are required in Visual Studio.<SPAN>&nbsp; <\/SPAN>The first thing you should&nbsp;do is delete the web.config file in the sub-project.<\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image013.png\" border=\"0\"><\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN>4)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>Next you need to adjust a few of the properties for the sub-project.<SPAN>&nbsp; <\/SPAN>Right click on the sub-project\u2019s node in solution explorer and select \u201cProperties\u201d.<SPAN>&nbsp; <\/SPAN>Under the \u201cCompile\u201d page change the \u201cBuild output path\u201d to \u201c..\\bin\\\u201d.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN>&nbsp;<\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image015.png\" border=\"0\"><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN>5)<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN><\/SPAN><\/SPAN><SPAN>Finally in the sub-project\u2019s properties, under the \u201cWeb\u201d page, select the \u201cUse IIS Web Server\u201d option and change the \u201cProject URL\u201d setting to \u201chttp:\/\/localhost\/MyLargeWebApp\/SubProject1\u201d.&nbsp; Also&nbsp;check the &#8220;Overwrite application root URL&#8221; and provide the&nbsp;URL to the&nbsp;root project, which in this case&nbsp;is &#8220;http:\/\/localhost\/MyLargeWebApp\/&#8221;.<SPAN>&nbsp;&nbsp;<\/SPAN>Do <U>not<\/U> click the \u201cCreate Virtual Directory\u201d button in the sub-project\u2019s setting as you don\u2019t want to create another application root in IIS at the sub-projects folder.<\/SPAN><\/P>\n<BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image017.png\" border=\"0\"><\/SPAN><\/P><\/BLOCKQUOTE>\n<P class=\"MsoNormal\"><SPAN><SPAN>6)<SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN>Once you\u2019ve updated these properties for the sub-project, the sub-project should be ready to go.<SPAN>&nbsp; <\/SPAN>Add some content to the default.aspx page in the sub-project and press F5.<SPAN>&nbsp; <\/SPAN>This should build the sub-project, deploy its DLL to the \\bin of the root project, and then run the page from the sub-project.<SPAN>&nbsp; <\/SPAN>If you select the root-project and \u201cShow All Files\u201d in the solution explorer, you will see in its \\bin folder that there are two deployed assemblies, one for the root project (MyLargeWebApp.dll) and one for the sub-project (SubProject1.dll).<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN>&nbsp;<\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image019.png\" border=\"0\"><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<H2><FONT size=\"4\">Summary<\/FONT><\/H2>\n<P class=\"MsoNormal\"><SPAN>This wraps up my first post on sub-projects.<SPAN>&nbsp; <\/SPAN>Hopefully it provides a quick introduction on how to setup a sub-project structure using the Web Application Project add-in for Visual Studio 2005.<SPAN>&nbsp; <\/SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>As mentioned in the beginning of the post, sub-projects are a good way to partition a single large ASP.NET application into several Visual Studio projects so you get the benefits of isolated development and deployment.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>Looking forward to hear from you about this post, and I&#8217;ll update with Part 2 hopefully next week.<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>&#8211;Omar<\/SPAN><\/P><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First a quick intro, since this my first post on the team blog.&nbsp; My name is Omar Khan.&nbsp; I&#8217;m the group program manager for the web development tools team.&nbsp; I manage the program management team that helps design the web tools inside of Visual Studio. This post is one of a three part series that [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7262,7263,7264],"class_list":["post-5404","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-development","tag-pm","tag-wap"],"acf":[],"blog_post_summary":"<p>First a quick intro, since this my first post on the team blog.&nbsp; My name is Omar Khan.&nbsp; I&#8217;m the group program manager for the web development tools team.&nbsp; I manage the program management team that helps design the web tools inside of Visual Studio. This post is one of a three part series that [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/5404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=5404"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/5404\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=5404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=5404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=5404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}