Share via

Build .sqlproj on Linux

Angandin 41 Reputation points Microsoft Employee
2022-02-09T21:03:29.53+00:00

Hello everyone, I have been using on Azure DevOps the task VSBuild to build, in a .yml pipeline, a Visual Studio Solution containing a SQL Database Project (.sqlproj). An example of the task is:

  • task: VSBuild@1
    displayName: "build deployment project"
    inputs:
    solution: ${{ parameters.solution }}
    platform: 'Any CPU'
    configuration: 'Release'

I am now facing the issue to build the same solution on a Linux machine, but I am not able to find a way to perform the same operation.
The desired output is to create a .DacPac file to deploy it on an Azure SQL Database.
Any thoughts?

Thank you all!

Andrea

Azure SQL Database
0 comments No comments

Answer accepted by question author

Oury Ba-MSFT 21,156 Reputation points Microsoft Employee Moderator
2022-02-11T16:49:59.283+00:00

Hi @Angandin Thank you for posting your question on Microsoft Q&A and for using Azure services.

In my understanding you are not able to build .sqlproj in a linux machine.
Could you please try the code below?

To build DacPac file on a Linux agent is done via MSBuild.Sdk.SqlProj Go to your database project directory in parallel to .sqlproj file create a directory like DB.Build under it create DB.Build.csproj copy.pase the content as below

<Project Sdk="MSBuild.Sdk.SqlProj/1.1.0"> <!-- This will pull in the required tools and dependencies to build a .dacpac with .NET Core -->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="..\src\DB\masterdata***.sql" /> <!-- link in the new .csproj to the .sql scripts in your existing database project -->
</ItemGroup>
</Project>

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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