Error while Publishing from Visual Studio 2005

Problem Description

Issues when you try to Publish your website from Visual Studio 2005. It might happen if you create a File System project called <someName> and while publishing you use the same name in IIS.

To reproduce this issue, create a simple File System based solution...

image

Go ahead and build the project and everything should be just fine. Then you need to publish this on IIS... (Junk in my case), you will see the following error message.

image

"You must choose a publish location that is not a sub-folder of the source Web Site".

The weird part of it is that, you will be able to create the Virtual Folder called Junk using the Create New Web Application button as can be seen below, but when you try to Publish the project, you won't be able to (as can be seen in the screen shot above).

image 

"Not good" is what you might say, and I won't differ much. In fact, if you try using Junk1, it would fail too. Now, try with MyJunk (or any other name that doesn't start with Junk). That should work and the Publish should succeed.

It is a product limitation and my preferred workaround for this particular issue is to use https://<serverName>/Junk and publish.

Hope this helps,
Rahul

Quote of the day:
Everyone is entitled to be stupid, but some abuse the privilege. - Unknown