Visual Studio 2008 project file does not load because of an unexpected encoding change.
Posted
by Xenan
on Stack Overflow
See other posts from Stack Overflow
or by Xenan
Published on 2010-03-23T10:09:46Z
Indexed on
2010/03/23
10:13 UTC
Read the original article
Hit count: 344
In our team we have a database project in visual Studio 2008 which is under source control by Team Foundation Server. Every two weeks or so, after one co-worker checks in, the project file won't load on the other developers machines. The error message is:
The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
When I look at the project file in Notepad++, the file looks like this:
??<NUL?NULxNULmNULlNUL NULvNULeNULrNULsNULiNULoNULnNUL
...
and so on (you can see <?xml version
in this)
whereas an normal project file looks like:
<?xml version="1.0" encoding="utf-16"?>
...
So probably something is wrong with the encoding of the file. This is a problem for us because it turns out to be impossible to get the file encoding correct again. The 'solution' is to throw away the project file an get the last know working version from source control.
According to the file, the encoding should be UTF-16. According to Notepad++, the corrupted file is actually UTF-8.
My questions are:
- Why is Visual Studio messing up the encoding of the project file, apparently at random times and at random machines?
- What should we do to prevent this?
- When it has happened, is there a possibility to restore the current file in the correct encoding instead of pulling an older version from source control?
As a last note: the problem is with one single project file, all other project files don't expose this problem.
© Stack Overflow or respective owner