简体   繁体   English

在Visual Studio 2010中使用目标构建时获取大量警告

[英]Getting lots of warnings when building with targets in Visual Studio 2010

I'm trying to build some code but getting lots of warnings in target files, stuff like this: 我正在尝试构建一些代码但在目标文件中收到大量警告,这样的事情:

Warning 12  The element 'ItemGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' 
has invalid child element 'TCS_Compile' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. 
List of possible elements expected: 
'Item, Reference, COMReference, COMFileReference, Xdcmake, Bscmake, ClCompile,
 ClInclude, Midl, ResourceCompile, PreLinkEvent, CustomBuildStep, Manifest, 
ProjectConfiguration, NativeReference, ProjectReference, Compile, EmbeddedResource, 
Content, Page, Resource, ApplicationDefinition, None, BaseApplicationManifest, 
Folder, Import, Service, WebReferences, WebReferenceUrl, FileAssociation, 
BootstrapperFile, PublishFile, CodeAnalysisDependentAssemblyPaths, 
CodeAnalysisDictionary, CodeAnalysisImport, Link, ResourceCompile, PreBuildEvent, 
PostBuildEvent' 
in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'.

Any ideas how I could fix these? 我有什么想法可以解决这些问题吗?

I had this problem too. 我也有这个问题。 After some googling, found a suggestion to close all the editor windows in VS, and then rebuild. 经过一些谷歌搜索,发现建议关闭VS中的所有编辑器窗口,然后重建。

Worked for me. 为我工作。

Info from [dead link]... 来自[死链接]的信息......

You can safely ignore this warning. 您可以放心地忽略此警告。 So does MSBuild validate your project files against the schema? 那么MSBuild是否根据模式验证您的项目文件? Yes it does, but I wasn't sure just how it was accomplished, so I fired off an email to Buck Hodges. 是的确如此,但我不确定它是如何完成的,所以我向Buck Hodges发了一封电子邮件。 He was nice enough to pass it by an as-yet-unnamed-dev on the MSBuild team. 他很擅长在MSBuild团队中传递一个尚未命名的开发者。 The dev stated that 开发者说

"...MSBuild does try to validate against the schema. However, the validation is done at runtime by our code rather than loading the [project] file using a validate reader with the xsd (mainly for perf reasons). MSBuild should fail any projects which don't adhere to the schema." “... MSBuild确实尝试对模式进行验证。但是,验证是在运行时由我们的代码完成的,而不是使用带有xsd的验证读取器加载[project]文件(主要是出于性能原因).MSBuild应该失败任何那些不遵守架构的项目。“

So there you have it. 所以你有它。 The schema is enforced while still allowing you to customize and extend the MSBuild project file to fit your needs. 强制执行模式,同时仍允许您自定义和扩展MSBuild项目文件以满足您的需要。

Another warning of my project had cause the xml to open in VS editor, which promptly displays a bunch of these warnings, even though the xml is not even close to being in the same project. 我的项目的另一个警告导致xml在VS编辑器中打开,即使xml甚至不在同一个项目中,它也会立即显示一堆这些警告。 Closing the file in the environment will remove the warnings. 关闭环境中的文件将删除警告。 They can be ignored otherwise. 否则他们可以被忽略。

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

相关问题 在Visual Studio 2010中生成时锁定文件 - Locking files when building in Visual Studio 2010 在Visual Studio 2010中是否在下划线警告? - Underline warnings in Visual Studio 2010? 在Visual Studio 2010中启用不匹配的命名空间警告 - Enable Mismatch namespace warnings in Visual Studio 2010 视觉工作室网站 - 许多随机错误,但仍在建设? - visual studio website - lots of random errors but still building? Visual Studio 2010 IDE构建失败,没有错误或警告 - Visual studio 2010 IDE build fails mysteriously with no errors or warnings Visual Studio 2010中的代码分析警告-CA1007 - Code Analysis Warnings in Visual Studio 2010 - CA1007 使用以下方法添加Microsoft.SqlServer.ManagedDTS时在Visual Studio 2015中获得警告:目标与应用程序不同的处理器 - Getting warning in Visual Studio 2015 when add Microsoft.SqlServer.ManagedDTS with: Targets a different processor than the application 在Visual Studio命令提示符2010中构建c#dll时如何指定.net目标框架? - How to specify .net target framework when building c# dll in Visual Studio Command Prompt 2010? 在Visual Studio 2012中为Office 2010构建VSTO项目时,出现“未安装Project Target Framework”错误 - “Project Target Framework Not installed” error comes when building the VSTO project for Office 2010 in Visual studio 2012 Visual Studio构建目标 - Visual Studio Build Targets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM