문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

I was having the same issue. The weird thing was I could publish from Visual Studio without a problem, but as soon as I tried to publish from the command-line using SqlPackage I got this error.

For me it turned out that there were duplicate SqlCmdVariable's in my *.publish.xml file. I removed the duplicates and now publish without a problem from the command-line.

I got the same error when deploying with SqlPackage.exe (with VS the deployment worked) but it wasn't an error in the publish file. My problem was, that I added the msdb two times with different versions. So please don't forget to check the Database-References for any duplicates.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top