I am using VS 2019 Professional for development. My solution has an SSAS tabular project in it. When building in VS2019P there are neither warnings nor errors. When I run my build pipeline in Azure DevOps the Visual Studio build task fails on this error.
Error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Business Intelligence Semantic Model\1.0\Microsoft.AnalysisServices.VSHostBuilder.targets" was not found. Also, tried to find "Business Intelligence Semantic Model\1.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 Studio\2019\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.
My Agent is:
My pipeline consists of:
I noticed when going through the verbose log that the build paths seem to be referencing Enterprise edition. However all other projects build.
When I run my build pipeline in Azure DevOps the Visual Studio build task fails on this error.
The direct cause of the issue is that SSAS tabular project has this line in the end of its project file:
<Import Project="$(MSBuildExtensionsPath)\Business Intelligence Semantic Model\1.0\Microsoft.AnalysisServices.VSHostBuilder.targets" />
When using msbuild to build the project, if it can't find the needed xx.targets file, then the MSB4226 occurs. And after my check, the missing file comes from one vs extension we have to manually install.
So in local machine, we get the ability to create, develop and build SSAS project in VS right after installing that extension:


But for Microsoft hosted windows-2019 agent, since it doesn't get the extension installed by default, the msbuild/VSbuild task in build pipeline doesn't have the ability to build the project, which causes the issue you met.
There's one similar feature request here, you can vote for and follow it to get news if there's any update.
As for temporary workarounds, you may consider using the self-hosted agent to run the build. Install the self-agent to one machine which has the VS with the extension installed, and specify to use self-agent when configuring build pipeline. The build should work.
Also, you can trying adding a command-line task before your build tasks with command here to install the extension before build. But since the extension package is build, it will increase build time significantly each time when you run the build. (Not recommended)
Hope all above helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With