11

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?

3
  • Is there VS 2005 installed on the same box?
    – alexm
    Commented Oct 26, 2011 at 6:04
  • 1
    +1 I have a similar problem when opening csproj files as xml in VS: every first element of ItemGroup and PropertyGroup is warned for as being in valid. Consecutive elements are not. I guess it has something to do with the schema file; could you post an example?
    – stijn
    Commented Oct 26, 2011 at 6:30
  • @alexm There is no VS 2005 but for some reason the Windows SDK Configuration Tool things there's 2005 and 2008 installed and doesn't list 2010...
    – meds
    Commented Oct 26, 2011 at 6:39

3 Answers 3

16

I had this problem too. After some googling, found a suggestion to close all the editor windows in VS, and then rebuild.

Worked for me.

11

Info from [dead link]...

You can safely ignore this warning. So does MSBuild validate your project files against the schema? Yes it does, but I wasn't sure just how it was accomplished, so I fired off an email to Buck Hodges. He was nice enough to pass it by an as-yet-unnamed-dev on the MSBuild team. 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."

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.

1

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. Closing the file in the environment will remove the warnings. They can be ignored otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.