visual-studio-2010 - 构建时 Microsoft.Common.Targets 中出现 "Has invalid child element"警告

标签 visual-studio-2010 visual-studio-2012 visual-studio-2013 visual-studio-2015

在我的 VS2010 中,当我构建解决方案时,Microsoft.Common.Targets 文件中有 100 多个警告。当我尝试构建、发布或运行我的程序时,我只收到警告,但当我双击它以获取更多信息时,Microsoft.Common.Targets 会弹出,然后我收到所有警告。

此文件 Microsoft.Common.Targets 是 .net 框架的一部分,具有 MSBuild 内置目标等。并且它具有在属性窗口中关联的适当架构。

一些警告示例(100 条中的 2 条):

Warning    2    The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'CustomBeforeMicrosoftCommonTargets' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'.    C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets    22    10    Miscellaneous Files
Warning    3    The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element '_OriginalConfiguration' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'.    C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets    60    10    Miscellaneous Files

为什么这个文件突然出现在我的编辑器中,而它不是我的项目的一部分,以及如何告诉 Visual Studio 在构建时忽略这个框架文件。

最佳答案

如果我关闭所有编辑器窗口,然后构建它,所有警告都会消失!即使关闭并重新启动 Visual Studio 也无法解决此问题,但只需从编辑器窗口关闭所有文件(包括 Microsoft.Common.Targets)即可解决该问题。啊微软!!

我在查看此链接后发现了这一点:

http://social.msdn.microsoft.com/Forums/en/Vsexpressvb/thread/31f52b76-b0de-406d-9c25-2f329dd7cf1c

也适用于 2013 和 2015 版本

关于visual-studio-2010 - 构建时 Microsoft.Common.Targets 中出现 "Has invalid child element"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7061556/

相关文章:

c++ - LNK 2022 : Inconsistent layout information, 迁移到VS2010后

visual-studio-2013 - 安装 Visual Studio 2013 Update 4 后如何修复 '"CheckAttributes“无法加载任务”错误

.net - Visual Studio 在打开 sql 项目时卡住了

c++ - 条件运算符在 VS2010 中的正确行为?

c++ - Visual Studio 2010 中新 ATL 项目的资源 ID 差距

c# - 没有可用源的未处理的 System.NotImplementedException?

asp.net-mvc - 如何让 MSBuild 使用被引用为 nuget 包的 MVC 程序集来构建我的解决方案

c# - 如何删除对象而不在 EF 中检索它

c - 如何在 main 下调用另一个函数 (VC++ C)

c++ - Visual Studio 2013 强制将 64 DLL 文件转换为 32 位应用程序 - 如何解决此问题?