简体   繁体   English

加载项目时出错:无法识别属性包含

[英]Error while loading project: Attribute Include is unrecognized

After merging two branches the Visual Studio has suddenly problems with loading a project.合并两个分支后,Visual Studio 在加载项目时突然出现问题。 When I try to reload, I always get the error当我尝试重新加载时,我总是收到错误

The attribute "Include" in element Reference is unrecognized.元素 Reference 中的属性“Include”无法识别。

I have no idea why this happened... how can I get the solution to load the project again?我不知道为什么会发生这种情况......我怎样才能获得再次加载项目的解决方案? Has anyone encountered this error message before and know what I have to look for to find the problem?有没有人以前遇到过这个错误信息并且知道我必须寻找什么才能找到问题?

The .csproj doesn't really look corrupt on the first sight... .csproj 乍一看并没有真正损坏......

Thanks in advance提前致谢

我发现了错误...与没有关闭标签的参考标签存在合并冲突,因为它在合并时被删除。

when you build the csproj file with MSBuild you get the line-number on which the error occurs.当您使用 MSBuild 构建 csproj 文件时,您会得到发生错误的行号。 This is unfortunately not visible in VisualStudio.不幸的是,这在 VisualStudio 中是不可见的。

  • Open the Develop Commnand Prompt for Visual Studio打开 Visual Studio 的开发命令提示
  • Navigate to the folder which contains the csproj file导航到包含 csproj 文件的文件夹
  • Run MSBuild运行 MSBuild

In the error, it contains the line-number with the error in the csproj file.在错误中,它包含 csproj 文件中带有错误的行号。 This helped me fixing the file after a GIT merge这帮助我在 GIT 合并后修复了文件

对我来说,xeraphim 的答案实际上为我指明了正确的方向,但对我来说,我的 csProj 文件中有一个额外的</Reference>标签,希望这对某人有所帮助。

在 macOS 上,我无法解决它,直到我删除 VS 2019 然后再次安装它,这很好地修复了它:)

我的情况是我有嵌套的 Reference 标签,这个错误是由使用 Git 扩展的 kdiff3 插件触发的。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM