Search code examples
asp.netvisual-studiovisual-studio-2010msbuild

Visual Studio build error "Illegal characters in path"


When I try to build my solution in Visual Studio (2010 SP1) containing a website, I get the following funny error.

------ Build started: Project: C:\...\Web\, Configuration: Debug Any CPU ------
Validating Web Site
: Build (web): Illegal characters in path.

Validation Complete

There is no more info whatsoever, even when build verbosity is set to diagnostic. I've tried to delete all the temporary files I could find, to restart everything I could. I even refetched my whole svn folder from scratch and rebuilt.. error still there. Then, quite randomly, the error disappeared. Now, about a day later, it's back.

  1. Have you ever experienced a similar behavior ? Could that be a bug of VS ?
  2. Is there a way to increase the verbosity of the Web Site validation step so that I would see more info about the error ?

Solution

  • After hours of troubleshooting I tried to debug visual studio with another instance and get to the internals of the exception. As a result, I have found the actual reason of the error :

    It happens when a path containing question mark is set as a base path for the web server deployment, i.e. under

    • web project's property pages (Shift+F4)
    • tab "Start options"
    • section "Server", value "Use custom server" with a "Base URL"

    An example of an invalid path is http://localhost/v8.0/xyz?user=User1. The reason is that the build process adds an additional slash at the end. Unfortunately VS is quite persistent in using the old setting value, so one has to restart it before rebuilding.