sql-server-data-toolssqlpackage

SQLPackage error: An item with the same key has already been added


I get this error from SQLPackage: "An item with the same key has already been added" What is the meaning? Google won't help me..

"c:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe" /Action:DeployReport /SourceFile:"XXX.dacpac" /Profile:"publish.xml" OutputPath:"Report.xml"

Generating report for database 'XXX' on server 'srv'.

* An item with the same key has already been added.

No output file is created.

Generate script from Visual Studio works (I get a script). I have tested with three projects in the same solution. Only one creates a DeploymentReport-file.

Publish works.


Solution

  • I just ran into this issue. For anyone else who gets this, try the following.

    1. Delete the [project].dbmdl file in the root of the project folder.
    2. Close and re-open the project.
    3. Clean the solution/project.
    4. Build the DACPAC again.
    5. Publish/Script/Report the DACPAC.

    I believe it is related to a cache of the dependancies becoming corrupt.