.net - SSDT(SSRS 和 SSAS)项目的 MSBuild 15.0 (Visual Studio 2017) 错误 MSB4067 : "The element <State> beneath element <Project> is unrecognized"

标签 .net msbuild visual-studio-2017 sql-server-data-tools msbuild-15

MSBuild 14.0(Visual Studio 2015 附带的版本)在构建包含 SSDT 项目(rptproj 或 dwproj 项目)的解决方案时记录警告 (MSB4078)。例如:

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



这很好,MSBuild 不支持 SSDT 项目,我们必须回退到使用 Visual Studio 构建它们(即 devenv.com)。例如,参见 this answer .

但是,当使用 MSBuild 15.0(Visual Studio 2017 附带的版本)时,构建相同的解决方案文件会给出以下 错误 :

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



虽然我可以从构建配置中删除 SSDT 项目,但这并不理想,因为我希望在从 Visual Studio 中构建解决方案时构建它们。

有没有办法将错误 MSB4067 降级为警告,或者在构建解决方案时跳过某些项目?

最佳答案

更新(2017 年 10 月)
适用于 Visual Studio 的 Microsoft Reporting Services 项目的最新版本 (1.18) adds MSBuild support for SSRS projects .安装后,SSRS 项目可以更新为 MSBuild 支持的格式,从而防止发生此问题。

原答案
这是一个 bug在 MSBuild 15 中,标记为“基础更新 2”中的修复。
GitHub issue thread 中给出的解决方法其中一位 MSBuild 维护者是:

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>
如果没有来自其他 .csproj 的项目依赖项,这似乎有效。项目到 .rptproj项目。

关于.net - SSDT(SSRS 和 SSAS)项目的 MSBuild 15.0 (Visual Studio 2017) 错误 MSB4067 : "The element <State> beneath element <Project> is unrecognized",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43735390/

相关文章:

c# - 我的程序集实际运行的是哪个版本的 .Net 框架?

Windows systemprofile 目录根据用户显示不同

MSBuild:在 NUnit 任务运行之前复制依赖项文件

asp.net - Visual Studio 2017 ASP.Net 发布独立的 Dot Net Core 应用程序

visual-studio - 无法移动foo.cs。目标文件夹与源文件夹相同

.net - 在方法 Y 中查找方法 X 的调用

c# - 什么是一些好的 .NET 分析器?

.net - 我应该担心混淆我的 .NET 代码吗?

xml - 使用 XML 文档部署 Web API 项目时生成服务器上的 "Access is denied"

asp.net-core - 系统找不到Visual Studio 2017 ASP.NET Core项目