Deployment failed: Exception calling "GenerateDeployReport" with "4" argument(s):

james.igoe's Avatar


14 Dec, 2017 06:30 PM

I have 2 Db projects, and I've worked through all the errors - referenced Db's - and warnings. The project builds on our build server, a record gets generated in our Octopus server. I resolved issues with connecting to the server- I made a mistake on the variables - but now getting stuck on the GenerateDeployReport piece in the SQL - Deploy DACPAC step.

My errors are below:

First thought:

  • Since this is occurring in both of my projects, I assume it is in error in my project


  • Does the place that this error occurs give me any indication of what I might be doing wrong?
  • What am I dong wrong? what needs to change?

Error Message:

Deployment failed: Exception calling "GenerateDeployReport" with "4" argument(s): 
"An error occurred during deployment plan generation. Deployment cannot continue." 
Reason: An error occurred during deployment plan generation. Deployment cannot continue.
  1. Support Staff 1 Posted by Kenneth Bates on 15 Dec, 2017 06:09 AM

    Kenneth Bates's Avatar

    Hi James,

    Thanks for getting in touch! Unfortunately at this stage I'm unable to determine what could be causing this issue. Would you be able to provide some additional details to help us dig a bit deeper to find out what's causing this?

    Could you send a screenshot of your whole step's configuration (SQL - Deploy DACPAC step)?
    Would you also be able to provide a copy of your verbose deployment logs with debugging variables enabled? The following doc page outlines how to produce and export this log.

    I look forward to hearing back and getting to the bottom of this!

    Kind regards,


  2. 2 Posted by arman.mnatsakan... on 17 Dec, 2017 06:23 PM

    arman.mnatsakanyan's Avatar

    Hi James,
    I had the same problem and found the solution here:

    If you're using this step template - , you can add the following lines in the beginning of function Add-DACAssemblies :
    #Arman added start
    Write-Host "Setting currentAppDomain (added by Arman)"
    $replacementEvidence = New-Object System.Security.Policy.Evidence
    $replacementEvidence.AddHost((New-Object System.Security.Policy.Zone ([Security.SecurityZone]::MyComputer)))
    $currentAppDomain = [System.Threading.Thread]::GetDomain()
    $securityIdentityField = $currentAppDomain.GetType().GetField("_SecurityIdentity", ([System.Reflection.BindingFlags]::Instance -bOr [System.Reflection.BindingFlags]::NonPublic))
    #Arman added end

  3. 3 Posted by james.igoe on 17 Dec, 2017 06:40 PM

    james.igoe's Avatar

    Will check out tomorrow AM (US ET) when I am in the office.


  4. Support Staff 4 Posted by Kenneth Bates on 21 Dec, 2017 01:56 AM

    Kenneth Bates's Avatar

    Hi James and Arman,

    Thanks for your input, @arman! I hope it helped James get going. Please don't hesitate to reach out if you come across any issues or concerns in the future. :)

    Kind regards,


  5. 5 Posted by james.igoe on 21 Dec, 2017 12:24 PM

    james.igoe's Avatar

    For now, I've made our admins aware of the issue, but had to implement a workaround:

    • Remove the external Db references, i.e., the project and the SQLCMDVariable
    • Script the view - the one that was using the external Db - as a post-deployment CREATE VIEW script
    • Mark the script as Always Copy and set Build = NONE

    This way, it builds, deploys, and then finishes up to recreate the missing script.

Reply to this discussion

Internal reply

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

Attaching KB article:


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


? 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