ssis-build
ssis-build copied to clipboard
ERROR: An item with the same key has already been added.
When trying to issue a build through Azure Devops Pipeline I get this error message:
When building from Visual Studio everything works fine, all the files are the same.
This is the powershell script in the pipeline:
Get-ChildItem -Filter *.dtproj -Recurse | Where-Object { -Not ($_.FullName -match "obj") } | ForEach-Object { &"$($env:BUILD_SOURCESDIRECTORY)\SSISBuild.2.1.2\tools\ssisbuild.exe" $_.FullName -Configuration $($env:TestConfig) -ProtectionLevel DontSaveSensitive if ($LASTEXITCODE -ne 0) { throw "Build failed."; } }
The issue occurs when project file has duplicate references to same parameters. Therefore naturally duplicate parameters cannot be added and you get generic LINQ error message.
What I would propose is to change in SsisBuild.Core.ProjectManagement.ProjectFile following lines Initialize method to
foreach (var parameter in parameters)
{
if (!_parameters.ContainsKey(parameter.Name))
_parameters.Add(parameter.Name, parameter);
}
But maybe author knows how better to handle this situation.
In our case it was package parameter name matching same user variable name.
Hi guys, we have hit this and we cannot find the issue. We can see that the problem is in a specific dtsx file, but as soon as we add it to the project we get this build issue.
We did have a duplicate variable name with the package parameter name, but we have now deleted that but the issue still remains
Can someone tell me how I can do what the build tool is doing so I can find the duplicate issue?
In our case it seems that we had two packages with the same name (in the package properties). It would be good if there was guarding on these dictionary adding to provide us with a better error message as it is very time consuming to try to find where this problem is without any clues at all
Even if there were a verbose mode so we knew what stage the code was at to get it down to a single thing we could work it out much more easily.
In our case it seems that we had two packages with the same name (in the package properties). It would be good if there was guarding on these dictionary adding to provide us with a better error message as it is very time consuming to try to find where this problem is without any clues at all
Even if there were a verbose mode so we knew what stage the code was at to get it down to a single thing we could work it out much more easily.
See my comment above. You can get source, add verbose message, compile and run locally. Sorry for not having enough time to create pull request. I'm not author of this utility.
I already submitted a PR for this in 2018.
https://github.com/rtumaykin/ssis-build/pull/28
When building SSIS projects using msbuild no error will be thrown if a package happens to have a name property which is the same as another in the project (this usually happens when copying packages). Go through the packages and make sure the names match the file names. I have some powershell to help with this. I'll link to it tomorrow.
Here you go: https://getitworking.net/ssis-build-an-item-with-the-same-key-has-already-been-added