Upgrading DACPAC Using the DACFx 3.0 API - How do I check the current version of an existing DAC database?

I am currently rewriting the database deployment of my Powershell script command to use the DACFx 3.0 API instead of 2.0. I managed to get a DACPAC update to work successfully using the new Microsoft.SqlServer.Dac.DacServices controller class.

The only problem that remains: how can I get the current version number of DACPAC from an existing database?

As part of our deployment of the script, we compare this with the version of DACPAC that we update to determine if deployment is required. It is also used to decide whether to run database-related tests, so we are saving a significant amount of time on our builds.

The old DacFx2.0 API is located in the Microsoft.SqlServer.Management.Dac namespace, so in the old Powershell script, we simply created a DacStore object from the database connection and disabled its property:

OUR OLD JACKET SCRIPT

 $dacStore = New-Object Microsoft.SqlServer.Management.Dac.DacStore($serverConnection) Write-Host "The following data-tier applications (instances) exist in the DAC store:" foreach($dacInstance in $dacStore.DacInstances) { Write-Host Instance Name: $dacInstance.Name Write-Host DAC Type Application Name: $dacInstance.Type.Name Write-Host DAC Type Version: $dacInstance.Type.Version <--- **** this is what I need **** } ... 

Now the problem is in version 3.0, the API is in the Microsoft.SqlServer.Dac namespace and "Instead of using the DacStore and DacExtractionUnit from previous versions, most of them have been reorganized into the all new DacServices controller class. ( Src )"

I have not yet been able to find the equivalent of DacStore in the DacServices class, so right now I do not know how to get the current version of DAC. I tried searching MSDN docs, but all of their Powershell sections still referenced the old DACFx2.0 API. (example: here ).

If anyone could help me, that would be very grateful. Thanks!

+4
powershell sql-server-2012 dacpac data-tier-applications
source share
1 answer

Just received a response from MSFT:

API Dac 3.0 API does not have the ability as you discovered. Use T-SQL to select this data directly from dbo.sysdac_instances.

It seems that this is actually the only way: http://msdn.microsoft.com/en-us/library/ee240830.aspx So now I will request this view, although I would really like to see it at some point in DACFx API Note that the dbo.sysdac_instances view is in the wizards database because msdb does not exist in SQL Azure.

+2
source share

All Articles