views:

113

answers:

3

Today, I tried to open one of my Visual Studio 2010 Express Edition projects and it failed to open. I thought that maybe the the file has been corrupted or something, but it turns out that all of my projects are doing this, including the ones that I haven't touched for months! This is the error message I'm getting:

D:\CSharp\Sandbox\MustardApplication1\MustardApplication1\MustardApplication1.csproj : error  : Unable to read the project file 'MustardApplication1.csproj'. 
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1693,24): The project file could not be loaded. '', hexadecimal value 0x0C, is an invalid character. Line 1693, position 24.

I have no idea what it's talking about, and I don't know what to do next. I can't even create a new "Windows Forms Application"; I get the same error message. Can anyone help me out?

+1  A: 

MSBuild has several .targets files which it uses to define common tasks. It happens to be an XML file, and hexedecimal value 0x0C is most definitely not a valid character.

I would say to open up that file in a good text editor such as Notepad++ and remove the offending character, but you may have to just replace that file with the default one since it appears to have been corrupted. Where you get just that file to replace I have no idea :(

At least you know exactly where to look.

Josh
Reinstalling the framework should fix up corrupted files.
Anna Lear
@Anna - I assume as much, but I was hoping MS would have an easier option :)
Josh
@Josh: I suppose you could just get an uncorrupted copy from a friend. Like in the good ol' days, bring it home on a floppy... :)
Anna Lear
@Anna - Ha Ha... That isn't a bad idea. Sounds like an interesting idea for a website. RepairFiles.com
Josh
+1  A: 

Somehow your Microsoft.Common.targets got corrupted.

Specifically, 0x0C is not a valid ASCII character (maps to ESC IIRC).

Look at the specific spot (line 1693, col 24), and remove or fix the offending part.

A reinstall/repair of the .NET 4 framework might work.

Alternatively, if you are using Windows 7, try using the 'restore previous version' command.

leppie
I repaired two Microsoft .NET 4 items from my Add/Remove programs list, and that got things working again. I don't know how it was corrupted in the first place (maybe an update?), but at least I'm back on track.
Professor Mustard
It looks like hitting "Enter" automatically submits your comment... I also wanted to say thanks to everyone for your helpful input!
Professor Mustard
A: 

Actually I met this issue the first time I installed VS2010 and tried to open a VS2008 solution. The reason is all the laptops in our company have McAfee enterprise installed, in whose secure list there is no VS2010 so it keeps scanning, resulting in the "Unable load project" issue. Hope this may help you.

Danny Chen