Reputation: 141
Every single project I open in Visual Studio 2013 is now all of a sudden giving me the following error:
EverySingleProject.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
This is in the file:
Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
Why is this failing?
Upvotes: 5
Views: 25164
Reputation: 1783
Removing the corresponding *.csproj.user file helped for the same symptoms.
Upvotes: 0
Reputation: 1963
I had this as well. The project was probably (undocumented!) a VS 2017 project and I was using VS 2013.
What I did was:
Really not ideal, but it was the quickest solution for a small demo project. Not sure how you'd go with a large solution. Maybe someone will build a converter sometime. Maybe Microsoft could do that. [Chuckles to self.]
Upvotes: 0
Reputation: 1541
Fixed it by adding:
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
in the .csproj file.
Upvotes: 0
Reputation: 2573
You also get this error if you try and open a VS 2017 RC 'simplified' .NET Core csproj file in an earlier version of Visual Studio.
These new project files look like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
</ItemGroup>
</Project>
You'll need to use a recent version of VS 2017 to open them.
Upvotes: 19
Reputation: 141
Turns out one of my files in the MSBuild folder got corrupted. This file: Microsoft.Common.CurrentVersion.targets
And another one of the files needed had vanished into the aether. This file: Microsoft.CSharp.CurrentVersion.targets
Neither of which were replaced, or fixed, during a repair and then a complete reinstall of Visual Studio.
I ended up copying the files across from another installation and now everything is back to normal.
Upvotes: 0
Reputation: 76
I've had this like 2 days ago.
This saved me.
Hope this helps.
EDIT:
Fortunately the solution is simple:
- In Windows Explorer navigate to the project
- Right Click on the .cproj file, select Properties, and un-check the "Read Only" checkbox
- Open up the .cproj file in Notepad
- On line 2 change xmlns="http://schemas.microsoft.com/developer/msbuild/2008" to xmlns="http://schemas.microsoft.com/developer/msbuild/2003" (notice this only difference is we changed 2008 to 2003)
- Save your changes
- In Visual Studio right click on the (currently unavailable) project and select "Reload Project"
- The project will now load normally and you can get on with your life
Upvotes: 3