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 ?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

If you are facing this problem after pulling from git , then you can follow it:

Step 1:

go to objDebug folder then find yourProject.csproj.FileListAbsolute.txt file
open it then delete what you found in building the project.
In my case i found ====>Head problem in building the project.
it followed the above step , and my problem solved.

Step 2:

delete obj folder then rebuild the project.

Method 3

Possible solution (found here, russian language):

  1. Create folder with simple and latin-only path – for example, c:Temp
  2. (Assuming you’re using Win7) go to Control Panel->System->Advanced System Settings->Advanced->Environment Variables
  3. Change “TMP” and “TEMP” variables from “%USERPROFILE%AppDataLocalTemp” to “C:Temp” and press OK in all open dialogs
  4. Restart Visual Studio

Method 4

In my case – move solution to place with short path and use latin characters.
Example:

C:/Projects/MyProject/

Method 5

I had the same problem with Visual Studio Community 2013, with Windows 8.1 (brazilian portuguese). Change of “TMP” and “TEMP” variables works fine for me.

Method 6

I encountered the same error in VS 2013. The issue for me was on the project properties -> Web (tab) there is ProjectUrl. this was pointing to wrong url

Method 7

I encountered the same symptoms with VS2015 Update 2 while working on a WIX installer. I had unloaded the .wixproj file, edited it and tried to reload it. VS claimed there was an illegal character in some path.
No information was provided about the location of the illegal character.

I backed out my change and again tried to reload the project. Same problem.
I found I had to close the solution and reopen it before the project would reload. Or simply restart Visual Studio.

Method 8

I was using VS 2019 community. There were two Visual studio opened. I had problem with one of them. When I was closing and re opening the visual studio it didn’t solved until I closed all visual studio windows and reopened them again.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x