Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build error in tfsbuild with database project

I have setup my .NET project in TFS Build. It builds fine locally, but I am getting this build error on the server:

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

I have no idea what it is, even googling didn't help much. My solution has some database projects. What is the issue here and how I can fix it?

like image 410
amateur Avatar asked Nov 03 '12 01:11

amateur


2 Answers

You need to install the SQL Server Data Tools on all build agents. When installing a TFS Build server, people often create agents to be on that or other machines.

You can download them from the MS SQL Server Data Tools Blog or Microsoft SQL Server Data Tools, and you choose the one that corresponds to the builds that you doing (Visual Studio 2010 or Visual Studio 2012).

Note: In some cases, the error mentions the path:
c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets
In such cases, install SQL Server Data Tools from SQL installation, not the link above.

like image 127
Preet Sangha Avatar answered Oct 20 '22 08:10

Preet Sangha


I have solved a similar issue by adding a new Solution Configuration that does not build the SQLPROJ. I then configured CI-CD (Azure DevOps Pipelines) to build that configuration. In a subsequent step of the Build, I exclusively build and pack the SQLPROJ. By thisI avoid having two Solutions - one of which will only have on project; the SQL Project.

Visual Studio Configuration Manager - with new Active Configuration that excludes the build of a DB SQLPROJ project

like image 43
Sherif Botros Avatar answered Oct 20 '22 07:10

Sherif Botros