Azure DevOps 构建失败 - MSB4226 - Analysis Services
Azure DevOps build failure - MSB4226 - Analysis Services
我正在使用 VS 2019 Professional 进行开发。我的 解决方案 中有一个 SSAS 表格项目。 在VS2019P中构建时,既没有警告也没有错误。当我在 Azure DevOps 中 运行 我的 构建管道 Visual Studio 构建任务因这个错误而失败。
Error MSB4226: The imported project "C:\Program Files (x86)\Microsoft
Visual Studio19\Enterprise\MSBuild\Business Intelligence Semantic
Model.0\Microsoft.AnalysisServices.VSHostBuilder.targets" was not
found. Also, tried to find "Business Intelligence Semantic
Model.0\Microsoft.AnalysisServices.VSHostBuilder.targets" in the
fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program
Files (x86)\MSBuild" . These search paths are defined in "C:\Program
Files (x86)\Microsoft Visual
Studio19\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe.Config".
Confirm that the path in the declaration is correct, and that
the file exists on disk in one of the search paths.
我的经纪人是:
- Windows 2019.
- 微软托管。
我的管道包括:
- 使用 NuGet 5.4。
- NuGet 还原。
- Visual Studio 构建(使用 visual studio 2019)
我在查看详细日志时注意到构建路径似乎引用了企业版。但是所有其他项目都会构建。
When I run my build pipeline in Azure DevOps the Visual Studio build
task fails on this error.
问题的直接原因是 SSAS tabular project
在其项目文件的末尾有这一行:
<Import Project="$(MSBuildExtensionsPath)\Business Intelligence Semantic Model.0\Microsoft.AnalysisServices.VSHostBuilder.targets" />
使用msbuild构建工程时,如果找不到需要的xx.targets
文件,就会出现MSB4226。经过我的检查,丢失的文件来自一个 vs extension 我们必须手动安装。
因此在本地机器中,我们能够在 VS 中创建、开发和构建 SSAS 项目 在 安装该扩展之后:
但是对于微软托管的windows-2019代理,由于默认没有安装扩展,构建管道中的msbuild/VSbuild任务没有构建项目的能力,这会导致您遇到的问题。
有一个类似的功能请求here,如果有任何更新,您可以投票并关注它以获取消息。
至于临时解决方法,您可以考虑使用self-hosted agent到运行构建。将self-agent安装到一台安装了扩展VS的机器上,并在配置build pipeline时指定使用self-agent。构建应该可以工作。
此外,您可以尝试使用命令 here 在构建任务之前添加命令行任务,以便在构建之前安装扩展。但是由于扩展包是构建的,每次 运行 构建时都会显着增加构建时间。 (不推荐)
希望以上对你有所帮助:)
我正在使用 VS 2019 Professional 进行开发。我的 解决方案 中有一个 SSAS 表格项目。 在VS2019P中构建时,既没有警告也没有错误。当我在 Azure DevOps 中 运行 我的 构建管道 Visual Studio 构建任务因这个错误而失败。
Error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Business Intelligence Semantic Model.0\Microsoft.AnalysisServices.VSHostBuilder.targets" was not found. Also, tried to find "Business Intelligence Semantic Model.0\Microsoft.AnalysisServices.VSHostBuilder.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe.Config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths.
我的经纪人是:
- Windows 2019.
- 微软托管。
我的管道包括:
- 使用 NuGet 5.4。
- NuGet 还原。
- Visual Studio 构建(使用 visual studio 2019)
我在查看详细日志时注意到构建路径似乎引用了企业版。但是所有其他项目都会构建。
When I run my build pipeline in Azure DevOps the Visual Studio build task fails on this error.
问题的直接原因是 SSAS tabular project
在其项目文件的末尾有这一行:
<Import Project="$(MSBuildExtensionsPath)\Business Intelligence Semantic Model.0\Microsoft.AnalysisServices.VSHostBuilder.targets" />
使用msbuild构建工程时,如果找不到需要的xx.targets
文件,就会出现MSB4226。经过我的检查,丢失的文件来自一个 vs extension 我们必须手动安装。
因此在本地机器中,我们能够在 VS 中创建、开发和构建 SSAS 项目 在 安装该扩展之后:
但是对于微软托管的windows-2019代理,由于默认没有安装扩展,构建管道中的msbuild/VSbuild任务没有构建项目的能力,这会导致您遇到的问题。
有一个类似的功能请求here,如果有任何更新,您可以投票并关注它以获取消息。
至于临时解决方法,您可以考虑使用self-hosted agent到运行构建。将self-agent安装到一台安装了扩展VS的机器上,并在配置build pipeline时指定使用self-agent。构建应该可以工作。
此外,您可以尝试使用命令 here 在构建任务之前添加命令行任务,以便在构建之前安装扩展。但是由于扩展包是构建的,每次 运行 构建时都会显着增加构建时间。 (不推荐)
希望以上对你有所帮助:)