简体   繁体   English

所有Visual Studio 2013构建现在都失败了

[英]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天前就有这个。

This saved me. 救了我。

Hope this helps. 希望这可以帮助。

EDIT: 编辑:

Fortunately the solution is simple: 幸运的是,解决方案很简单:

  1. In Windows Explorer navigate to the project 在Windows资源管理器中,导航到项目
  2. Right Click on the .cproj file, select Properties, and un-check the "Read Only" checkbox 右键单击.cproj文件,选择“属性”,然后取消选中“只读”复选框
  3. Open up the .cproj file in Notepad 在记事本中打开.cproj文件
  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) 在第2行将xmlns =“http://schemas.microsoft.com/developer/msbuild/2008”更改为xmlns =“http://schemas.microsoft.com/developer/msbuild/2003”(请注意,这只是我们的区别所在2008年改为2003年)
  5. Save your changes 保存更改
  6. In Visual Studio right click on the (currently unavailable) project and select "Reload Project" 在Visual Studio中右键单击(当前不可用)项目并选择“重新加载项目”
  7. 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: 我做的是:

  1. Create a new VS 2013 web application project, 创建一个新的VS 2013 Web应用程序项目,
  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.] [对自己轻笑。]

删除相应的* .csproj.user文件有助于解决相同的症状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AutoMapper测试在构建期间失败,但在Visual Studio 2013中本地传递 - AutoMapper Test is Failing during builds but passes in locally in visual studio 2013 代码在视觉工作室2015上编译但在2013年失败 - code compiles on visual studio 2015 but failing on 2013 Visual Studio 2013错误列表未显示失败的构建上的错误 - Visual Studio 2013 Error List not showing errors on failed builds Visual Studio 2013仅生成HTML更改,而不生成C#更改 - Visual Studio 2013 only builds HTML changes, not C# changes 从Visual Studio 2013运行测试会构建不相关的项目 - Running tests from Visual Studio 2013 builds unrelated projects 为Visual Studio中的所有构建定义条件常量 - Define a conditional constant for all builds in Visual Studio 在Visual Studio 2013中递归查找所有引用 - Find all references recursively in visual studio 2013 Visual Studio 2013编码的UI无法识别单选按钮 - Visual Studio 2013 Coded UI failing to recognise Radio buttons Visual Studio即使在同一文件中也无法检测到现有对象。 项目仍在建设中 - Visual Studio failing to detect existing objects, even from within the same file. Project still builds Visual Studio 2013 和 2015 - Visual Studio 2013 and 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM