How to build SQL Server Data Project on Ubuntu

Paul Hernandez 681 Reputation points Microsoft Employee
2021-03-17T09:54:54.15+00:00

Hi everyone,

we are currently designing CI/CD Pipelines and the build server we have available at the moment is a Ubuntu machine.

I investigated a lot and it seems that this combination is just a bad idea and I really need a windows build server. Basically the CI pipeline is just a task to pull the sources from git and another task to build either the Visual Studio Solution or the Database Project (*.sqlproj).

In theory I should be able to do it with .Net Core but I need the "Microsoft/VisualStudio/v11.0/SSDT/Microsoft.Data.Tools.Schema.SqlTasks.targets". I could not find any way to get this installed on Ubuntu.

I tried also using Azure Data Studio instead of Visual Studio 2019. This allow me to develop in any platform but I am still not able to build the project in a linux agent without any user interface.

I also followed this post ssdt-dacpac-netcore.html

This worked but is a kind of workaround using .Net Core 2.x which already reached EOL and I want to avoid it.

Is there any recommended solution that makes sense or I just request as a hard requirement a Windows based agent (build server)?

Any help will be appreciated.

Best regards,

Paul

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,437 questions
{count} votes

Accepted answer
  1. ErikEJ 341 Reputation points MVP
    2021-03-17T18:10:30.523+00:00

    The tool in the blog link also support .NET Core 3.1 & 5.


1 additional answer

Sort by: Most helpful
  1. Paul Hernandez 681 Reputation points Microsoft Employee
    2021-03-19T15:24:36.18+00:00

    Hi @ErikEJ ,
    Thanks for your reply.
    Somehow when I tried to build the project, even when I specified the correspondent target framework in the project file: <TargetFramework>netstandard2.0</TargetFramework>
    When I build the package it throws an error:

    The current SDK bundles target framework 'netcoreapp5.0'

    I navigated to the MSBuild.Sdk.SqlProj github and create a new project with the command line as documented in the repo.

    I was able to built it empty.

    Now I added the ItemGroup section on the project file. In Visual Studio I am able to see how the class library project recognizes the SQL files of the database project:

    project

    First build failed beacause I referenced a master database schema from some views. Therefore, I added an artifact reference as in the database project:

       <ItemGroup>  
       <Content Include="..\edl-synapse-dwh-databases\**\*.sql" />  
       <ArtifactReference Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\AzureDw\SqlSchemas\master.dacpac">  
       <HintPath>$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\AzureDw\SqlSchemas\master.dacpac</HintPath>  
       <SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>  
       <DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>  
       </ArtifactReference>  
       </ItemGroup>  
    

    That did not solve the issue. Appart from that I have around 109 errors, others related to the role memberships which could not be found.

    Could you please provide further suggestions.

    Thanks,
    Paul

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.