When creating Visual Studio 2005 Websites you have an option to choose the storage location and the way that the website will be loaded:
> File > New > Website

I often use one of the 2 options here, either File System (when debugging it brings up a new instance of Cassini web server), or HTTP – which when selected let’s you host your website through the IIS web server.
This is all great – it works perfectly in either case, and covers a wide range of developer needs.
But what do you do if in the middle of the project you need to change your project from one to the other?
Let’s examine a situation where we have a File System website which needs to be converted to HTTP website…
Ok, so we have a locally created website, “hosted“ on your local web server (Cassini)… the first thing when converting it to the HTTP type you would naturally go and find the project file and change some properties in it…but wait… ASP.NET 2.0 WebSites (except Web Application projects!) doesn’t have a project file…
What do you do next… you find the solution file, you can find it on a location similar to this one:
C:\Documents and Settings\Your_User \My Documents\Visual Studio 2005\Projects\Your_Project\…
When you edit it, you see information like this:
Project(”{E24C65DC-7377-472B-9ABA-BC803B73C61A}”) = “D:\…\Your_Project\“, “D:\Your_Project “, “{3A5484C0-6B04-48FB-BDF1-88D2A6C42161}”
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.VirtualPath = “/Your_Project“
Debug.AspNetCompiler.PhysicalPath = “D:\Your_Project\“
Debug.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Debug.AspNetCompiler.Updateable = “true”
Debug.AspNetCompiler.ForceOverwrite = “true”
Debug.AspNetCompiler.FixedNames = “false”
Debug.AspNetCompiler.Debug = “True”
Release.AspNetCompiler.VirtualPath = “/Your_Project“
Release.AspNetCompiler.PhysicalPath = “D:\Your_Project“
Release.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Release.AspNetCompiler.Updateable = “true”
Release.AspNetCompiler.ForceOverwrite = “true”
Release.AspNetCompiler.FixedNames = “false”
Release.AspNetCompiler.Debug = “False”
VWDPort = “12898″
DefaultWebSiteLanguage = “Visual Basic”
EndProjectSection
EndProject
Note that this is only a part of the solution file, but a part which interest us the most.
Note also all the paths and places where our project is mentioned (either by name, physical or virtual location)
Now let’s change this to be a HTTP hosted Website:
Project(”{E24C65DC-7377-472B-9ABA-BC803B73C61A}”) = “http://localhost/Your_Project/“, “ http://localhost/Your_Project/“, “{352053F2-DDA1-4C02-B734-DC658AF85E25}”
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.VirtualPath = “/Your_Project“
Debug.AspNetCompiler.PhysicalPath = “D:\Your_Project“
Debug.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Debug.AspNetCompiler.Updateable = “true”
Debug.AspNetCompiler.ForceOverwrite = “true”
Debug.AspNetCompiler.FixedNames = “false”
Debug.AspNetCompiler.Debug = “True”
Release.AspNetCompiler.VirtualPath = “/Your_Project“
Release.AspNetCompiler.PhysicalPath = “D:\Your_Project“
Release.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Release.AspNetCompiler.Updateable = “true”
Release.AspNetCompiler.ForceOverwrite = “true”
Release.AspNetCompiler.FixedNames = “false”
Release.AspNetCompiler.Debug = “False”
SlnRelativePath = “D:\development\DNN\DEV040003\“
DefaultWebSiteLanguage = “Visual Basic”
EndProjectSection
EndProject
So actually what you need to do from File System to the HTTP model is (this is probably also valid vice-versa… from HTTP to File System model)
- Change the relative paths from the start to the http:// valid paths
- Remove VWDPort param (and probably other “VWD…*” params)
- Add SlnRelative path as noted above
And that should be it!
Something very similar to this worked a colleague of mine with who I’ve looked at this problem this morning.
Filed under:
.NET,
ASP.NET
Written on: 15 May 2006 ·
8 Comments »