SQL DACPAC Deploy errors

I’m having an issue with the community created SQL Deploy DACPAC step that is preventing the DAC Service from running. I’m running Octopus v3.12.4 on Win 2012r2 with SQL Server 2012. I can see in the Octopus Deploy Task logs that I’m logged in as the proper user (I know the login works) and it has found the DacPack object. However, I see the wrong SQL Server version “130” folder in the path the the SQL Server assemblies. It should be 110 for version 11 or SQL 2012. My visual studio database project is set to build the project for SQL 2012. I have also installed the SQL Server 2012 DAC Framework with SQLSysClrTypes and SqlDOM installers. The actual error message I receive is that the step cannot connect to the database: Deployment failed: Exception calling “Extract” with “4” argument(s): “Could not connect to database server.” . However, I see that the error message is misleading, per this link: https://blogs.msdn.microsoft.com/sqlserverfaq/2016/10/12/error-could-not-deploy-package-unable-to-connect-to-target-server/

Your input would be great.

Thanks,
Rob

Hi Rob,

Thanks for getting in touch, I’ve had a look at the step template and it searches for the DAC assemblies in the default installation folder for SQL so if you have multiple versions installed it might find the wrong one, as it does in your case.

I’ve added an issue to update the step template to be a bit smarter, by adding an additional parameter to select the SQL version. In the meantime you can modify the script to look in the right folder by modifying this line $SearchPathList = @("${env:ProgramFiles}\Microsoft SQL Server", "${env:ProgramFiles(x86)}\Microsoft SQL Server") in the Add-DACAssemblies function to only look in the 110 folder, e.g. $SearchPathList = @("${env:ProgramFiles}\Microsoft SQL Server\110", "${env:ProgramFiles(x86)}\Microsoft SQL Server\110").

I hope that helps.

Thank you and best regards,
Henrik

Henrik, thanks so much for the detailed information. It looks like this is exactly the issue. I updated the script and that got me past this problem. Much appreciated.

I’m now facing the problem with error: Deployment failed: Exception calling “Load” with “1” argument(s): "Could not load package from ‘’ and it provides the file name. So… ugh. I was only providing the file name until I realized that it expects the full file name.

thanks,
Rob

Hi Rob,

Great to hear you got it all sorted in the end. I’ll update the help text of the filename parameter to mention it needs to be the full filename.

Thanks,
Henrik

Hi Henrik,

Actually, I thought it was sorted out but it seems that the installation step cannot find my dacpac file. What path do I specify in the DACPAC Package Name in order to get the dacpac file location? I have tried a few different paths with no luck. I continue to get the error: Reason: Could not load package from …

thanks,
Rob

Hi Rob,

Can you send through the following:

  • Raw task log of the latest deployment
  • Screenshot of your deployment process
  • Screenshot of how you’ve configured your DACPAC step template
    and I’ll see if I can figure out what is causing this error for you.

Thanks,
Henrik

Henrik, I got it to work. I had mistakenly put the wrong package step name into the field that did the work of deploying the dacpac package. That was one of my problems, the next was having the proper SQL Server security to install the dacpac. Both errors did not provide helpful error messages but they looked to be Powershell error messages.

Please note that the SQL Deploy DACPAC script takes care of 2 items: 1.) inputting the correct path to the dacpac file and this is based off of the previous package step’s (Octopus.Action[StepName].Output.Package.InstallationDirectoryPath) and 2.) then it adds the .dacpac file extension onto the variable. So, the filename on the page should not be supplied with the full path or the .dacpac extension.

thanks again,
Rob

Hi Rob,

Thanks for letting me know and good to hear you got it resolved in the end.

I’ll update the step template with some more helpful error messages and only add the .dacpac extension if the filename doesn’t already have it.

Thanks,
Henrik

thanks for updating this step. I’m using the latest and it works great.