Jeffrey Palermo (.com)

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
How to develop an ASP.NET web project without IIS binding - level 200

If you've every shared an ASP.NET project or worked on one on multiple computer, you know what a pain it is to ensure that all computers have the same IIS virtual directory configured.  If you don't, the project won't open.

For ASP.NET 1.1, it's easier to use a class library project instead of a web project.  You lose a bit of designer support, but you gain project portability.  If you are like me, you don't use the designer at all, and it's all gain and no loss.

The trick is to delete the *.csproj.webinfo file,  take your web project and open the .csproj file in notepad.  Then find the following at the top of the file:

<VisualStudioProject>
    <CSHARP
        ProjectType = "Web"
        ProductVersion = "7.10.3077"
        SchemaVersion = "2.0"
        ProjectGuid = "{09E1A7E2-B51D-42EA-A2BE-4A5991BDF2A7}"
    >. . . . . . .

And just change "Web" to "Local"

<VisualStudioProject>
    <CSHARP
        ProjectType = "Local"
        ProductVersion = "7.10.3077"
        SchemaVersion = "2.0"
        ProjectGuid = "{09E1A7E2-B51D-42EA-A2BE-4A5991BDF2A7}"
    >. . . . . <snip/>

Literally, that's all it takes.  Now your poject opens as a class library, and you just set up IIS to wherever the project is.  You can debug just like before, and you can use pages and user controls just like before.

One note:  Change the project type back to "Web" before upgrading to .Net 2.0 or the project conversion wizard won't properly create a website.

 


Posted Mon, Jul 25 2005 7:19 PM by Jeffrey Palermo

[Advertisement]

Comments

joeyDotNet wrote ASP.NET without web projects
on Mon, Jul 25 2005 7:02 PM
Figured I would repost one of my postings from my old blog to go along
with Jeffery Palermo's latest...
Christopher Steen - Learning .NET wrote Link Listing - July 25, 2005
on Mon, Jul 25 2005 8:57 PM
Ajax.NET for Microsoft ASP.NET 2.0 (beta)
BackgroundWorker and Web Services
Data Source Controls...
Christopher Steen - Learning .NET wrote Link Listing - July 25, 2005
on Mon, Jul 25 2005 9:00 PM
Ajax.NET for Microsoft ASP.NET 2.0 (beta)
BackgroundWorker and Web Services
Data Source Controls...
Christopher Steen - Learning .NET wrote Link Listing - July 25, 2005
on Mon, Jul 25 2005 9:00 PM
Ajax.NET for Microsoft ASP.NET 2.0 (beta)
BackgroundWorker and Web Services
Data Source Controls...
Sam wrote re: How to develop an ASP.NET web project without IIS binding - level 200
on Mon, Jul 25 2005 9:40 PM
As a followup, you can also use the Cassini WebServer with the ClassLibrary tactic to avoid IIS completely. You can develop on XP-Home if you need to; you can check-in the Cassini executable and have everything you need to edit & run the project (as long as you install the cassini.dll to the GAC, or write a batch file to do it for you); you can just forget about IIS configuration issues and get to work faster. I personally wouldn't go back to IIS. :)
.Net Adventures wrote re: How to develop an ASP.NET web project without IIS binding - level 200
on Mon, Jul 25 2005 11:57 PM
On this url (http://pluralsight.com/wiki/default.aspx/Fritz.AspNetWithoutWebProjects) you can find better way how to setup ASP.NET web project without IIS binding.
Jeffrey Palermo wrote re: How to develop an ASP.NET web project without IIS binding - level 200
on Tue, Jul 26 2005 5:40 AM
Sam,
I have used Cassini to develop on XP Home edition, but I prefer IIS. For many.Net applications, Cassini works, but for more advanced apps, you need the configurability of IIS.
Jeremy D. Miller wrote re: How to develop an ASP.NET web project without IIS binding - level 200
on Tue, Jul 26 2005 7:06 AM
Cool. You should probably still go to the headache to get the virtual directory setup in the NAnt build though. Did this make it any easier to run NUnit on the code? I've bumped into all sort of weirdness in the past trying to create classes in NUnit that are part of a web project.
Jeffrey Palermo wrote re: How to develop an ASP.NET web project without IIS binding - level 200
on Tue, Jul 26 2005 7:54 AM
The build doesn't require a virtual directory. It's just a class library build and a copy of the aspx files to the IIS directory. NUnit stuff is easier because NUnit can reference the class library.
John wrote re: How to develop an ASP.NET web project without IIS binding - level 200
on Tue, Jul 26 2005 11:19 AM
If you ever need to move the solution somewhere else (I have to move from local to development for code review), you can change the sln file.

There's a line like Project("<guid>") = "<project>", "<url here>",...
change the url to the new server address and it will change the project file for you. If you just change the project, VS will complain about them not be in synch
Jason Haley wrote Interesting Finds
on Thu, Jul 28 2005 7:47 PM
Omar Villarreal's WebLog wrote Building Visual Studio 2003 solutions with Team Build
on Tue, Mar 27 2007 5:49 PM

I recently had to customize a Team Build script to build only one VS2003 solution and found that Nagaraju...