Fix Sql Unit Test build failure in Azure Devops pipeline
Recently I have faced an issue when adding the SQL DB project and SQL Unit test project to my existing .net core solution. In my local machine I am able to build successfully but the build failed in Azure devops pipeline.
I got the below error when I build with .net core CLI.
Error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.301\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.301\\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" is correct, and that the file exists on disk.
Some of the discussions mentioned that specifying the vs SSDT path will fix the issue. So i have unloaded the project and edited the paths as below.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets
But no luck with that also. Since my most of the projects are in the .net core version and these two SQL DB project and SQL Unit test project are in .net 4.5 and 4.72 versions. This is the reason to the failure. So I ended with changing the .net core cli task to VSbuild version 1 task.
I have disabled the .net core cli build task and added the VS build task.
This is my configuration for VSBuild task.
I hope this will help someone who is facing the same issue.
I got the below error when I build with .net core CLI.
Error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.301\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.301\\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" is correct, and that the file exists on disk.
Some of the discussions mentioned that specifying the vs SSDT path will fix the issue. So i have unloaded the project and edited the paths as below.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets
But no luck with that also. Since my most of the projects are in the .net core version and these two SQL DB project and SQL Unit test project are in .net 4.5 and 4.72 versions. This is the reason to the failure. So I ended with changing the .net core cli task to VSbuild version 1 task.
I have disabled the .net core cli build task and added the VS build task.
This is my configuration for VSBuild task.
I hope this will help someone who is facing the same issue.
Comments
Post a Comment