SSDT, do I need different dacpacs if I need to deploy the same db to SQL Server 2008 and 2012?
Asked Answered
G

3

5

While converting database project to SSDT and upgrading to SQL Server 2012 I need deployment script to work for both SQL Server 2008 and 2012.

I am using sqlpackage.exe /Action:Publish to deploy the latest database bits.

In sqlproj project properties I do see a target platform dropdown with options 2005/2008/2012 sql server. Does it generate a different dacpac if I change this target platform? Do I need to carry two versions of dacpac for each sql server version?

Or will the same dacpac work for any version of sql server?

Graber answered 23/5, 2012 at 17:40 Comment(0)
F
4

The short answer is yes - different DACPACs for different SQL Server editions. Bob Beuachemin wrote a useful blog post about DAC Fx3.0 vs. DAC 2.0

Fimble answered 23/5, 2012 at 23:30 Comment(0)
D
9

I know this is 11 months old, but there is an option when you come to deployment specifically for this scenario - AllowIncompatiblePlatform.

//Set Deployment Options
DacDeployOptions dacOptions = new DacDeployOptions();
dacOptions.AllowIncompatiblePlatform = true;

Without setting the option I can deploy a 2008 dac to sql2012, but it will error if I deploy a 2012 dac to sql2008 with:

Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentCompatibilityException: 
A project which specifies SQL Server 2012 as the target platform cannot be published to SQL Server 2008.

Setting the option means I do not get this error and can deploy to previous versions (back to 2005 I believe). NB You may also need to set the option TreatVerificationErrorsAsWarnings to true - YMMV.

Debi answered 3/5, 2013 at 12:8 Comment(1)
I was able to deploy a SQL2012 dacpac to SQL2008R2 with just the AllowIncompatiblePlatform = true; option.Poultice
F
4

The short answer is yes - different DACPACs for different SQL Server editions. Bob Beuachemin wrote a useful blog post about DAC Fx3.0 vs. DAC 2.0

Fimble answered 23/5, 2012 at 23:30 Comment(0)
F
3

From the command line using SqlPackage.exe, use the p:AllowIncompatiblePlatform option. A warning will still be shown but it will continue. This works from a SQL Server 2012 dacpac going to SQL Sever 2008 R2.

SqlPackage.exe /Action:Publish 
   /SourceFile:"testdb.dacpac" 
   /TargetDatabaseName:testDb 
   /p:AllowIncompatiblePlatform=true
   /TargetServerName:"testserver"
Foreignborn answered 31/10, 2015 at 17:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.