locked
DacServices.ImportBacPac - how can I ignore warnings? RRS feed

  • General discussion

  • I'm writing code to transfer a SQL 2008 DB to Azure. I can generate the bacpac and from the command line import it successfully. There is a warning about compatibility but it completes as required. Unfortunately we need to do it from code and the warning terminates the process by throwing an exception:

    'An error occurred during deployment plan generation. Deployment cannot continue.\r\nWarning SQL0: A project which specifies SQL Server 2008 as the target platform may experience compatibility issues with Microsoft Azure SQL Database v12.\r\n'

    There is an inner exception:

    '"Failed to import target model LXT1545. Detailed message Value cannot be null.\r\nParameter name: conn"'

    And a final inner exception:

    'Value cannot be null.\r\nParameter name: conn"'

    I am setting the target engine when I export:

     dacServices.ExportBacpac(result.FilePath, SourceLayer.Connection.Database, new DacExportOptions {TargetEngineVersion=EngineVersion.V12}, new List<Tuple<string, string>>());

    Unfortunately we have to do this entirely in code. Going via powershell or cmd is not an option as the machine we run this on will not have sqlpackage.exe available.

    Friday, April 22, 2016 9:10 AM