MSBuild 15.0 (Visual Studio 2017) error MSB4067 for SSDT (SSRS and SSAS) projects: “The element beneath element is unrecognized”

后端 未结 2 719
余生分开走
余生分开走 2021-02-05 20:04

MSBuild 14.0 (the version included with Visual Studio 2015) logs warnings (MSB4078) when building a solution which contains SSDT projects (rptproj or dwproj projects). For examp

相关标签:
2条回答
  • 2021-02-05 20:56

    Update (October 2017)

    The latest version of Microsoft Reporting Services Projects for Visual Studio (1.18) adds MSBuild support for SSRS projects. With this installed, SSRS projects can be updated to a format supported by MSBuild, which prevents this problem from happening.


    Original Answer

    This is a bug in MSBuild 15, labelled for fix in "foundation update 2".

    A workaround as given in the GitHub issue thread by one of the MSBuild maintainers is:

    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>
    

    This seems to work provided that there are no Project Dependencies from other .csproj projects to the .rptproj projects.

    0 讨论(0)
  • 2021-02-05 21:04

    Skipping projects can be done with /ignoreprojectextensions:.rptproj, but I still get the warning (on VS2015) so presumably you would still get the error.

    What is possible is to specify a list of the ones you do want to build with

    msbuild /t:myCsProj /t:mySqlProj /t:myOtherProjThatIsntaRptProj
    

    Whether or not this is viable, of course, depends on how many "other" projects you have in your solution.

    Alternatively, there are some ways of bodging MSBuild to be able to cope with other project types (e.g. https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/).

    I've seen this approach "in the wild" a couple of times, but only ever for SSIS. I have heard it can be made to work for SSRS/SSAS too though.

    0 讨论(0)
提交回复
热议问题