在Microsoft.Common.Targets中创build“有无效的子元素”警告

在我的VS2010中,当我构build我的解决scheme时, Microsoft.Common.Targets文件中有100多条警告。 当我尝试构build,发布或运行我的程序时,我得到的只是警告,但是当我双击它以获取更多信息时,Microsoft.Common.Targetspopup,然后我得到所有的警告。

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

一些示例警告(2 100):

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在构build时忽略这个框架文件。

如果我closures所有的编辑器窗口,然后build立它,所有的警告消失了! 即使closures和重新启动Visual Studio也没有解决这个问题,但只要closures编辑器窗口中的所有文件,包括Microsoft.Common.Targets,就可以解决问题。 微软啊!

看了这个链接后我发现了这个:

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

也适用于2013年和2015年版本