Can Visual Studio 2015 database project publish to both SQL Server _and_ Azure?
Asked Answered
B

1

8

I have a solution that needs to target both SQL Server 2014 and Microsoft Azure SQL database V12.

In my project settings, if I set the target platform to Azure, I cannot publish to a SQL Server - I get this error:

A project which specifies Microsoft Azure SQL Database v12 as the target platform cannot be published to SQL Server 2014.

If I set the target platform to SQL Server 2014 and try to publish to an Azure database, I get the inverse error.

Is there any way to publish to both platforms without having to change the project settings each time?

Please note that I am not trying to migrate. I need to support both flavors of database with my scripts.

Biform answered 25/5, 2016 at 19:13 Comment(1)
flavors...so true. One is cloudy, the other tastes of on-prem... hints of vanilla and smoke and pain and sufferingSecundines
S
11

When you deploy you can use AllowIncompatiblePlatform flag which should let it deploy.

I am using Azure V12 and Local Db Sql 2016 and it is publishing to the local db instance without the flag so maybe something changed in that version or the latest ssdt as well.

Edit 2020:

Local db is at 2016 and the latest Azure has some keywords that it doesn't support so using Local db is getting harder (probably isn't worth it anymore). A local dev instace or container is probably the way to go (or even a small azure sqldb per dev)

Sixteenmo answered 26/5, 2016 at 5:40 Comment(3)
They seem to have removed that option (I am using Update 2.) I also don't see anything hidden in the .sqlproj. Does that flag appear in your .sqlproj? I wonder if I manually add it if the functionality might still exist.Biform
This worked for me by adding <AllowIncompatiblePlatform>True</AllowIncompatiblePlatform> to my *.publish.xmlMagical
yes it is either in the publish profile or however you call the deploy you can add it there (sqlpackage.exe = /p:AllowIncompatiblePlatform = true) or DacFx has a deployment option you can setSixteenmo

© 2022 - 2024 — McMap. All rights reserved.