dacpac deployment issues

abhibadd's Avatar

abhibadd

25 Feb, 2018 03:04 PM

i am trying to deploy dac pac file to db server which is 2008 r2 getting this error (file attached), can someone give me the solution.

{shorter version of error down here}

Dacpac Filename: D:\octopusdeploy\PBPS Print - DEV\PitneyDataDev.Database\1.0.14_1\PitneyDataDev.dacpac
03:10:25 Verbose | Dacpac Profile: D:\octopusdeploy\PBPS Print - DEV\PitneyDataDev.Database\1.0.14_1\PitneyDataDev.publish.xml
03:10:25 Verbose | Target server: *******
03:10:25 Verbose | Target database: PitneyDataDev
03:10:25 Verbose | Using integrated security: False
03:10:25 Verbose | Username: colorprint
03:10:25 Verbose | Report: True
03:10:25 Verbose | Script: True
03:10:25 Verbose | Deploy: True
03:10:25 Verbose | Extract target database dacpac False
03:10:25 Verbose | Deployment contributors: #{AdditionalDeploymentContributors}
03:10:25 Verbose | Deployment contributor arguments: #{AdditionalDeploymentContributorArguments}
03:10:25 Verbose | Loading the DacFX Assemblies
03:10:25 Verbose | Searching for: Microsoft.SqlServer.TransactSql.ScriptDom.dll
03:10:25 Verbose | Searching: C:\Program Files\Microsoft SQL Server
03:10:25 Verbose | Searching: C:\Program Files (x86)\Microsoft SQL Server
03:10:25 Verbose | Found: C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.TransactSql.ScriptDom.dll
03:10:25 Verbose | Searching for: Microsoft.SqlServer.Dac.dll
03:10:25 Verbose | Searching: C:\Program Files\Microsoft SQL Server
03:10:25 Verbose | Searching: C:\Program Files (x86)\Microsoft SQL Server
03:10:25 Verbose | Found: C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\Microsoft.SqlServer.Dac.dll
03:10:25 Verbose | Adding the type: C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.TransactSql.ScriptDom.dll
03:10:25 Error | Add-Type : Could not load file or assembly 'file:///C:\Program Files (x86)\Micr
03:10:25 Error | osoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.TransactSql.ScriptDom.d
03:10:25 Error | ll' or one of its dependencies. This assembly is built by a runtime newer than
03:10:25 Error | the currently loaded runtime and cannot be loaded.
03:10:25 Error | At C:\Octopus\Work\20180224031001-73311-49\Script.ps1:112 char:10
03:10:25 Error | + Add-Type <<<< -Path $ScriptDomDLL.FullName
03:10:25 Error | + CategoryInfo : NotSpecified: (:) [Add-Type], BadImageFormatExce
03:10:25 Error | ption
03:10:25 Error | + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerSh
03:10:25 Error | ell.Commands.AddTypeCommand
03:10:25 Verbose | Updating manifest with output variables
03:10:25 Verbose | Updating manifest with action evaluated variables
03:10:25 Fatal | The remote script failed with exit code 1
03:10:25 Verbose | at Octopus.Worker.Scripting.ScriptResult.EnsureSuccessful()
                    | at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.<>c__DisplayClass29_0.<ExecuteActionAndInitLoggingContext>b__0()
                    | at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteWithTransientErrorDetection(Action action, Machine machine)
                    | at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteActionAndInitLoggingContext(PlannedStep step, Machine machine, PlannedAction action)
03:10:25 Fatal | SQL - Deploy DACPAC on DMEMCFDB0
                    |
                    | == Success: Apply retention policy on Tentacles ==
03:10:20 Info | Apply retention policies...
03:10:20 Info | Tentacle retention policy set to 'keep all'
03:10:20 Verbose | Apply Tentacle Retention Policy completed
                    |

  1. Support Staff 1 Posted by Daniel Fischer on 26 Feb, 2018 02:59 AM

    Daniel Fischer's Avatar

    Hi,

    Thanks for getting in touch! I had a look into this and I believe I've found the issue. Your log file states that the your server has PowerShell v1 and v2 on it and .NET v2 on it (CLR version). I did some digging and found that the Sql Server 2012 SDK assemblies require .NET v4 and thus you also need PowerShell v3 or newer as well. I'd recommend upgrading your server so you can take advantage of the DACPAC community step.

    Let me know if this helps. :)

    Best regards,
    Daniel

  2. 2 Posted by abhibadd on 27 Feb, 2018 02:49 AM

    abhibadd's Avatar

    Hi,
    i have installed .net v4.5.2 and powershell v4 now facing different issue.
    please find attachment

  3. Support Staff 3 Posted by Daniel Fischer on 27 Feb, 2018 04:00 AM

    Daniel Fischer's Avatar

    Hi,

    It looks like this issue could be a couple of things. The script is failing when PowerShell adds the following DLL's and tries to load the DAC assemblies and fails.

    02:47:30   Verbose  |       Adding the type: C:\Program Files\Microsoft SQL Server\140\DAC\bin\Microsoft.SqlServer.TransactSql.ScriptDom.dll
    02:47:30   Verbose  |       Adding the type: C:\Program Files\Microsoft SQL Server\140\DAC\bin\Microsoft.SqlServer.Dac.dll
    02:47:30   Info     |       Loaded the DAC assemblies
    02:47:30   Error    |       Deployment failed: Exception calling "Load" with "1" argument(s): "The type
    02:47:30   Error    |       initializer for 'Microsoft.SqlServer.Dac.DacPackage' threw an exception."
    02:47:30   Error    |       Reason: The type initializer for 'Microsoft.SqlServer.Dac.DacPackage' threw an
    02:47:30   Error    |       exception.
    

    I did a search online and found a few different possible causes. You will need to determine which one is relevant based on your environment and not Octopus by the looks of it.

    Older conversation with the same error.

    More recent conversation on StackOverflow.

    Let me know if you are able to resolve your issue with the above resources. :)

    Best regards,
    Daniel

  4. 4 Posted by abhibadd on 27 Feb, 2018 03:57 PM

    abhibadd's Avatar

    Hi,
    i installed ssdt, dac framework, SqlsysClrTypes,
    tried to deploy again still got the error.

  5. Support Staff 5 Posted by Daniel Fischer on 28 Feb, 2018 02:04 AM

    Daniel Fischer's Avatar

    Hi,

    Thanks for the update. It looks like this time the dependent DLL files were loaded and we have a different error.

    This new error seems to be having trouble calling GenerateDeployReport:

    14:22:14   Error    |       Deployment failed: Exception calling "GenerateDeployReport" with "4"
    14:22:14   Error    |       argument(s): "An error occurred during deployment plan generation. Deployment
    14:22:14   Error    |       cannot continue."
    14:22:14   Error    |       Reason: An error occurred during deployment plan generation. Deployment cannot
    14:22:14   Error    |       continue.
    14:22:14   Error    |       At C:\Octopus\Work\20180227142040-73624-29\Script.ps1:348 char:3
    14:22:14   Error    |       +         Throw ("Deployment failed: {0} rnReason: {1}" -f
    14:22:14   Error    |       $.Exception.Message, $.Ex ...
    14:22:14   Error    |       +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    14:22:14   Error    |       ~~~~~~~~~
    14:22:14   Error    |       + CategoryInfo          : OperationStopped: (Deployment fail...annot conti
    14:22:14   Error    |       nue.:String) [], RuntimeException
    14:22:14   Error    |       + FullyQualifiedErrorId : Deployment failed: Exception calling "GenerateDe
    14:22:14   Error    |       ployReport" with "4" argument(s): "An error occurred during deployment pla
    14:22:14   Error    |       n generation. Deployment cannot continue."
    14:22:14   Error    |       Reason: An error occurred during deployment plan generation. Deployment ca
    14:22:14   Error    |       nnot continue.
    

    I did some looking into this and from what I can see this could be related to your sqlproj being aimed at the wrong sql version. The following conversation seems to have the same error that you are now seeing and included how they troubleshooted this issue.

    https://help.octopusdeploy.com/discussions/problems/44798-dacpac-de...

    Let me know if this helps. :)

    Best regards,
    Daniel

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • ServerTasks-73311.log.txt 13.5 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac