msbuild: Build error MSB4067 (UnrecognizedChildElement) when building a solution with rptproj or dwproj projects

When using MSBuild 15.0, cleaning or building a solution which contains rptproj or dwproj projects gives the following error:

Reports.rptproj(3,3): error MSB4067: The element <State> beneath element <Project> is unrecognized.

When using MSBuild 14.0, the behaviour is better: it logs warnings (MSB4078) about unsupported projects:

warning MSB4078: The project file “Reports.rptproj” is not supported by MSBuild and cannot be built.

The latter behaviour is more desirable (for me, at least): I would like to able to build a solution in a configuration which includes the .rptproj files. This would allow me to include these projects when building the solution in Visual Studio, and to be able to use the same configuration when building the solution via an MSBuild script.

Is this change of behaviour a bug? The message certainly seems like it is attempting to parse the rptproj file into some structure to which it doesn’t belong. If it is not, is there a way to downgrade the error MSB4067 to a warning, or to skip certain projects when building a solution? The /ignoreprojectextensions:.rptproj option does not prevent the error.

Note: this issue relates to this Stack Overflow post.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 12
  • Comments: 28 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Workarounds

  • Place a file with these contents next to your .sln file with the special name after.{yoursolutionname}.sln.targets:
<Project InitialTargets="WorkAroundMSBuild2064">
 <Target Name="WorkAroundMSBuild2064">
  <!-- Work around https://github.com/Microsoft/msbuild/issues/2064 by
       removing *.rptproj from the generated solution metaproject. -->
  <ItemGroup>
   <ProjectReference Remove="%(ProjectReference.Identity)"
                     Condition="'@(ProjectReference->'%(Extension)')' == '.rptproj'" />
  </ItemGroup>
 </Target>
</Project>
  • Build with devenv {path_to_solution.sln} /build
    • This uses Visual Studio to handle parsing the solution and building each individual project, so it will behave much more like “Build” from the UI.
    • This can be slower and harder to debug than using MSBuild.
  • Use a solution configuration to prevent the .rptproj files from building

Any updates or timeline on when this issue will be resolved?

FYI… @marcpopMSFT @dotnet/msbuild team this issue has 23 upvotes from the community in https://github.com/NuGet/Home/issues/7796. In summary, NuGet.exe invokes msbuild.exe during restore to identify the project references for a project. As per @kartheekp-ms’s analysis https://github.com/NuGet/Home/issues/7796#issuecomment-1076622574, it looks like something changed in msbuild version after 15.9 where msbuild.exe started returning a failure exit code when trying to read project references for a custom project (for example vdproj in this case). This happens even when ContinueOnError is set to WarnAndContinue (new behavior after 15.9 version). NuGet raises an exception in this case causing restore failures.

Is there any update on this issue?

Is there any plan to resolve fundamentally this issue?

This is a big breaking change. We too now have broken solutions on our build machines because of this. Can someone please triage?