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/