Skip to main content

Notifications

Dynamics 365 Community / Blogs / Navision 360 / An item with the same key h...

An item with the same key has already been added | Extension Error NAV 2017

Problem:

Recently i faced an issue while publishing the extension to NAV2017 server instance. The error was as follow:

WARNING: UnhandledErrorMessage
Publish-NAVApp : An item with the same key has already been added.
At line:1 char:1
+ Publish-NAVApp -ServerInstance DynamicsNAV100 -Path ‘E:\Dynamics NAV …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Publish-NAVApp], ArgumentException

 + FullyQualifiedErrorId : System.ArgumentException,Microsoft.Dynamics.Nav.Apps.Management.Cmdlets.PublishNavApp

I search alot on internet but found nothing much helpful then I got an idea and tried the steps I mentioned on the Micossoft Community Forum. You can also view them here.

Error Reason:

I had upgraded a Database from NAV 5.0 to NAV 2017 and did some customization in NAV 2017 (upgraded database). Now I wanted to deploy these changes(Customization) using Extension (.navx package). For this purpose I created a package/app with .navx extension and tried to publish at my new upgraded database. When ever i tried, i get an error An item with the same key has already been added. Finally I solved it by doing step mentioned here but the reason for this error is as I had upgraded the data also from 5.0 to 2017 so what happens is in NAV 5.0 [dbo].[Object] stores information about the objects according to the Company Name i.e if you have two companies like I had CRONUS Danmark A/S and CRONUS Test, there will be two entries for same object in the [dbo].[Object] but each will have different Company Name. For example lets have a look at the Table 3 Payment Terms

In NAV 5.0 :
DBO-Object-In-NAV-5.0.JPG

In NAV 2017 Standard Demo Database these records are:

Standard-DB-Object.JPG

When I upgraded the database from NAV 5.0 to NAV 2017 and checked the Object table, it was like:

Upgraded-DBO-Object-2017.JPG

So you can clearly see the difference here that instead of these two records shown above, there must be a single record with blank Company Name as it is in standard database.

That was the brief explanation of the issue, hope that it will be helpful.

Related Links:

 

Comments

*This post is locked for comments