Unable to publish to Azure SQL Database using sqlpackage in ubuntu

Singh, Prabhu 6 Reputation points
2022-06-15T16:40:33.823+00:00

Hi Team,

I have below csproj file to build dacpac.

<Project Sdk="MSBuild.Sdk.SqlProj/2.0.0">  
  <PropertyGroup>  
    <TargetFramework>netstandard2.0</TargetFramework>  
    <DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP>  
</PropertyGroup>  
  
  <ItemGroup>  
    <Content Include="..\dbo\**\*.sql" />  
    <Content Include="..\jobs\*.sql" />  
    <Content Include="..\PostDeploymentScript\*.sql" />  
  </ItemGroup>  
  
  <ItemGroup>  
    <Content Remove="..\PostDeploymentScript\*.sql" />  
    <None Include="..\PostDeploymentScript\*.sql" />  
  </ItemGroup>  
  
  <ItemGroup>  
    <PostDeploy Include="..\PostDeploymentScript\Script.PostDeployment.sql" />  
  </ItemGroup>  
  
</Project>  

And build is getting succeed by using below command,

msbuild /t:Build Database.Build.csproj /p:Configuration=Release /p:Platform="Any cpu" /p:OutDir=/database.build/output

But when trying to use for publish to Azure SQL database using sqlpackage in ubuntu am getting below error,

"*** An error occurred during deployment plan generation. Deployment cannot continue.
A project which specifies SQL Server 2019 as the target platform cannot be published to Microsoft Azure SQL Database v12."

And here is my sqlpackage command,

sqlpackage /action:Publish /SourceFile:"/database.build/output/Database.Build.dacpac" /TargetConnectionString:"Data Source=tcp:dev-sqlserver-shared-sql.database.windows.net,1433;Initial Catalog=test-dev;Persist Security Info=False;User ID=XXXX;Password=YYYYYY;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"

Can someone please help regarding this issue.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,763 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Singh, Prabhu 6 Reputation points
    2022-06-15T17:18:54.393+00:00

    I can able to fix it by changing from this line "<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP". to "<SqlServerVersion>SqlAzure</SqlServerVersion>".

    Now publish to azure sql is working.

    Thanks

    1 person found this answer helpful.