5

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?

0

6 Answers 6

19

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>

(From: https://blogs.msdn.microsoft.com/dotnet/2016/12/12/updating-visual-studio-2017-rc-net-core-tooling-improvements/)

You'll need to use a recent version of VS 2017 to open them.

1
  • 2
    Is it possible to downgrade / convert the .csproj file so I can use the rest of the codebase in Visual Studio 2015? I downloaded an Open Source project where the maintainer has simply upgraded the Project to VS2017, so now I can no longer open it in VS 2015.
    – Shiva
    Apr 16, 2017 at 6:49
3

I've had this like 2 days ago.

This saved me.

Hope this helps.

EDIT:

Fortunately the solution is simple:

  1. In Windows Explorer navigate to the project
  2. Right Click on the .cproj file, select Properties, and un-check the "Read Only" checkbox
  3. Open up the .cproj file in Notepad
  4. 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)
  5. Save your changes
  6. In Visual Studio right click on the (currently unavailable) project and select "Reload Project"
  7. The project will now load normally and you can get on with your life
4
  • 2
    It should be a little obvious that "change 2008 to 2003" cannot be the proper solution for this question. Sep 15, 2015 at 11:59
  • Sorry but that did nto work for me. I am still unable to build any of my C# projects. All give the same error. Sep 15, 2015 at 11:59
  • Have tried multiple times with multiple projects and still no joy. Sep 15, 2015 at 12:07
  • I get the same error when trying to add a new project to an empty solution. Sep 15, 2015 at 12:23
0

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.

0

Fixed it by adding:

<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

in the .csproj file.

1
  • 1
    You may be able to do this to force it to run, but it won't be running the right toolsversion and output errors.
    – obizues
    May 22, 2019 at 18:04
0

I had this as well. The project was probably (undocumented!) a VS 2017 project and I was using VS 2013.

What I did was:

  1. Create a new VS 2013 web application project,
  2. Copy and paste all the rest of the original project files into the new project folder,
  3. Open the new project and include all the necessary original project files,
  4. Mess about with references, etc for a while until all the compile errors disappear,
  5. Run, test, tweak.

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.]

0

Removing the corresponding *.csproj.user file helped for the same symptoms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.