And*_*net 12 .net msbuild sql-server-data-tools visual-studio-2017 msbuild-15
MSBuild 14.0(Visual Studio 2015附带的版本)在构建包含SSDT项目(rptproj或dwproj项目)的解决方案时记录警告(MSB4078).例如:
警告MSB4078:MSBuild不支持项目文件"Reports.rptproj",无法构建.
这很好,MSBuild不支持SSDT项目,我们必须回归到使用Visual Studio(即devenv.com)构建它们.例如,请参阅此答案.
但是,使用MSBuild 15.0(Visual Studio 2017附带的版本)时,构建相同的解决方案文件会出现以下错误:
Reports.rptproj(3,3):错误MSB4067:元素<Project>下的元素<State>无法识别.
虽然我可以从构建配置中删除SSDT项目,但这并不理想,因为我希望在Visual Studio中构建解决方案时构建它们.
有没有办法将错误MSB4067降级为警告,或者在构建解决方案时跳过某些项目?
And*_*net 13
更新(2017年10月)
最新版本的Microsoft Reporting Services Services for Visual Studio(1.18)增加了对SSRS项目的MSBuild支持.安装此项后,可以将SSRS项目更新为MSBuild支持的格式,从而防止出现此问题.
原始答案
这是MSBuild 15中的一个错误,标记为"基础更新2"中的修复.
一个MSBuild维护者在GitHub问题线程中给出的解决方法是:
.sln使用特殊名称将包含这些内容的文件放在文件旁边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>
Run Code Online (Sandbox Code Playgroud)
这似乎有效,前提是项目依赖性从其他.csproj项目到.rptproj项目.