[英]All Visual Studio 2013 builds are now failing
Every single project I open in Visual Studio 2013 is now all of a sudden giving me the following error: 我在Visual Studio 2013中打开的每个项目现在都突然给我以下错误:
EverySingleProject.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. EverySingleProject.csproj:错误:项目的默认XML名称空间必须是MSBuild XML名称空间。 If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. 如果项目是以MSBuild 2003格式创作的,请在元素中添加xmlns =“http://schemas.microsoft.com/developer/msbuild/2003”。 If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. 如果项目是以旧的1.0或1.2格式编写的,请将其转换为MSBuild 2003格式。 C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\Microsoft.Common.CurrentVersion.targets 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" Project ToolsVersion =“12.0”DefaultTargets =“Build”xmlns =“http://schemas.microsoft.com/developer/msbuild/2003”
Why is this failing? 为什么这会失败?
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. 如果您尝试在早期版本的Visual Studio中打开VS 2017 RC“简化”.NET Core csproj文件,也会出现此错误。
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/ ) (来自: 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. 您需要使用最新版本的VS 2017来打开它们。
I've had this like 2 days ago. 我2天前就有这个。
Hope this helps. 希望这可以帮助。
EDIT: 编辑:
Fortunately the solution is simple: 幸运的是,解决方案很简单:
- In Windows Explorer navigate to the project 在Windows资源管理器中,导航到项目
- Right Click on the .cproj file, select Properties, and un-check the "Read Only" checkbox 右键单击.cproj文件,选择“属性”,然后取消选中“只读”复选框
- Open up the .cproj file in Notepad 在记事本中打开.cproj文件
- 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) 在第2行将xmlns =“http://schemas.microsoft.com/developer/msbuild/2008”更改为xmlns =“http://schemas.microsoft.com/developer/msbuild/2003”(请注意,这只是我们的区别所在2008年改为2003年)
- Save your changes 保存更改
- In Visual Studio right click on the (currently unavailable) project and select "Reload Project" 在Visual Studio中右键单击(当前不可用)项目并选择“重新加载项目”
- The project will now load normally and you can get on with your life 该项目现在将正常加载,您可以继续您的生活
Turns out one of my files in the MSBuild folder got corrupted. 原来我在MSBuild文件夹中的一个文件被破坏了。 This file: Microsoft.Common.CurrentVersion.targets 此文件:Microsoft.Common.CurrentVersion.targets
And another one of the files needed had vanished into the aether. 另外一个需要的文件已经消失在以太网中。 This file: Microsoft.CSharp.CurrentVersion.targets 此文件:Microsoft.CSharp.CurrentVersion.targets
Neither of which were replaced, or fixed, during a repair and then a complete reinstall of Visual Studio. 在修复和完全重新安装Visual Studio期间,这些都没有被替换或修复。
I ended up copying the files across from another installation and now everything is back to normal. 我最终从另一个安装中复制文件,现在一切都恢复正常了。
Fixed it by adding: 修正了它:
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
in the .csproj file. 在.csproj文件中。
I had this as well. 我也有这个。 The project was probably (undocumented!) a VS 2017 project and I was using VS 2013. 该项目可能(未记载!)VS 2017项目,我使用的是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.] [对自己轻笑。]
删除相应的* .csproj.user文件有助于解决相同的症状。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.