title: CRM solution import failed "an item with the same key has already been added"
body: <p>I have a strange behaviour in one of our CRM-Organizations.</p>
  
  <p>When I export a solution (which only contains the account-entity) as an unmanaged solution it works.</p>
  
  <p>But when I reimport this very same solution without changing anything I get this error</p>
  
  <p>"an item with the same key has already been added".</p>
  
  <p>I found out that I have to remove the Attribute "ownerid" from the solution (and one relationship) and then it works... </p>
  
  <p>this is the attribute</p>
  
  <pre><code>    &lt;attribute PhysicalName="OwnerId"&gt;
            &lt;Type&gt;owner&lt;/Type&gt;
            &lt;Name&gt;ownerid&lt;/Name&gt;
            &lt;LogicalName&gt;ownerid&lt;/LogicalName&gt;
            &lt;RequiredLevel&gt;systemrequired&lt;/RequiredLevel&gt;
            &lt;DisplayMask&gt;ValidForAdvancedFind|ValidForForm|ValidForGrid|RequiredForForm&lt;/DisplayMask&gt;
            &lt;ImeMode&gt;auto&lt;/ImeMode&gt;
            &lt;ValidForReadApi&gt;1&lt;/ValidForReadApi&gt;
            &lt;ValidForCreateApi&gt;1&lt;/ValidForCreateApi&gt;
            &lt;IsCustomField&gt;0&lt;/IsCustomField&gt;
            &lt;IsAuditEnabled&gt;1&lt;/IsAuditEnabled&gt;
            &lt;IsSecured&gt;0&lt;/IsSecured&gt;
            &lt;IntroducedVersion&gt;5.0.0.0&lt;/IntroducedVersion&gt;
            &lt;SourceType&gt;0&lt;/SourceType&gt;
            &lt;LookupStyle&gt;single&lt;/LookupStyle&gt;
            &lt;LookupTypes&gt;
              &lt;LookupType id="00000000-0000-0000-0000-000000000000"&gt;8&lt;/LookupType&gt;
              &lt;LookupType id="00000000-0000-0000-0000-000000000000"&gt;9&lt;/LookupType&gt;
            &lt;/LookupTypes&gt;
            &lt;displaynames&gt;
              &lt;displayname description="Vertriebsverantwortlicher" languagecode="1031" /&gt;
              &lt;displayname description="Owner" languagecode="1033" /&gt;
              &lt;displayname description="Właściciel" languagecode="1045" /&gt;
            &lt;/displaynames&gt;
            &lt;Descriptions&gt;
              &lt;Description description="Geben Sie den Benutzer oder das Team ein, der bzw. das mit der Verwaltung des Datensatzes betraut ist. Dieses Feld wird aktualisiert, wenn der Datensatz einem anderen Benutzer zugewiesen wird." languagecode="1031" /&gt;
              &lt;Description description="Enter the user or team who is assigned to manage the record. This field is updated every time the record is assigned to a different user." languagecode="1033" /&gt;
              &lt;Description description="Wprowadź nazwę użytkownika lub zespołu, który zarządza rekordem. To pole jest aktualizowane za każdym razem, gdy rekord zostanie przypisany do innego użytkownika." languagecode="1045" /&gt;
            &lt;/Descriptions&gt;
          &lt;/attribute&gt;
  </code></pre>
  
  <p>I also checked the serverlogs and found this:</p>
  
  <pre><code>&lt;importexportxml start="635818108905329459" stop="635818109069971342" progress="22.2222222222222" processed="true"&gt;
  &lt;solutionManifests&gt;
      &lt;solutionManifest languagecode="1031" id="Firma_Transfer" LocalizedName="Firma_Transfer" processed="true"&gt;
          &lt;UniqueName&gt;Firma_Transfer&lt;/UniqueName&gt;
          &lt;LocalizedNames&gt;
              &lt;LocalizedName description="Firma_Transfer" languagecode="1031" /&gt;
          &lt;/LocalizedNames&gt;
          &lt;Descriptions /&gt;
          &lt;Version&gt;1.0.0&lt;/Version&gt;
          &lt;Managed&gt;0&lt;/Managed&gt;
          &lt;Publisher&gt;
              &lt;UniqueName&gt;myorg&lt;/UniqueName&gt;
              &lt;LocalizedNames&gt;
                  &lt;LocalizedName description="Myorg" languagecode="1031" /&gt;
              &lt;/LocalizedNames&gt;
              &lt;Descriptions /&gt;
              &lt;EMailAddress /&gt;
              &lt;SupportingWebsiteUrl /&gt;
              &lt;Addresses&gt;
                  &lt;Address&gt;
                      &lt;City /&gt;
                      &lt;Country /&gt;
                      &lt;Line1 /&gt;
                      &lt;Line2 /&gt;
                      &lt;PostalCode /&gt;
                      &lt;StateOrProvince /&gt;
                      &lt;Telephone1 /&gt;
                  &lt;/Address&gt;
              &lt;/Addresses&gt;
          &lt;/Publisher&gt;
          &lt;results /&gt;
          &lt;result result="success" errorcode="0" errortext="" datetime="13:08:12.07" datetimeticks="635818072920798192" /&gt;
      &lt;/solutionManifest&gt;
  &lt;/solutionManifests&gt;
  &lt;upgradeSolutionPackageInformation&gt;
      &lt;upgradeRequired&gt;0&lt;/upgradeRequired&gt;
      &lt;upgradeValid&gt;1&lt;/upgradeValid&gt;
      &lt;fileVersion&gt;7.0.1.129&lt;/fileVersion&gt;
      &lt;currentVersion&gt;7.0.1.129&lt;/currentVersion&gt;
      &lt;fileSku&gt;OnPremise&lt;/fileSku&gt;
      &lt;currentSku&gt;OnPremise&lt;/currentSku&gt;
  &lt;/upgradeSolutionPackageInformation&gt;
  &lt;entities&gt;
      &lt;entity LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="true"&gt;
          &lt;result result="failure" errorcode="0x80044150" errortext="Ein Element mit dem gleichen Schlüssel wurde bereits hinzugefügt." datetime="13:08:26.96" datetimeticks="635818073069658863" /&gt;
      &lt;/entity&gt;
  &lt;/entities&gt;
  &lt;nodes /&gt;
  &lt;settings /&gt;
  &lt;dashboards /&gt;
  &lt;securityroles /&gt;
  &lt;workflows /&gt;
  &lt;templates /&gt;
  &lt;optionSets /&gt;
  &lt;ConnectionRoles /&gt;
  &lt;SolutionPluginAssemblies /&gt;
  &lt;SdkMessageProcessingSteps /&gt;
  &lt;ServiceEndpoints /&gt;
  &lt;webResources /&gt;
  &lt;reports /&gt;
  &lt;FieldSecurityProfiles /&gt;
  &lt;convertrules /&gt;
  &lt;routingrules /&gt;
  &lt;Slas /&gt;
  &lt;languages&gt;
      &lt;language&gt;
          &lt;result result="success" errorcode="0" errortext="" datetime="13:08:11.07" datetimeticks="635818072910798185" /&gt;
      &lt;/language&gt;
  &lt;/languages&gt;
  &lt;entitySubhandlers&gt;
      &lt;savedQuery LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/&gt;
      &lt;formXml LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"&gt;
      &lt;/formXml&gt;
      &lt;entityCustomResources LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/&gt;
      &lt;entityRibbon LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/&gt;
      &lt;savedQueryVisualization LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"&gt;
      &lt;/savedQueryVisualization&gt;
  &lt;/entitySubhandlers&gt;
  &lt;rootComponents&gt;
      &lt;rootComponent processed="false" /&gt;
  &lt;/rootComponents&gt;
  &lt;dependencies&gt;
      &lt;dependency processed="false" /&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>All I found in the internet pointed to an problem with an attribute (missmatching type, ...) but in my case this is the same organization and no transfer from dev to prod or something like that...</p>
  
  <p>We are using CRM 2015 but we had this problem in 2011 already.</p>
  
  <p>Has anybody a solution for this? we don't want to edit the customization.XML everytime before importing a solution...</p>
  
  <p>this is the database-field</p>
  
  <pre><code>[OwnerId] [uniqueidentifier] NOT NULL CONSTRAINT [DF_AccountBase_OwnerId]  DEFAULT ('00000000-0000-0000-0000-000000000000')
  </code></pre>
  
  <p>thanks</p>
  
  <p>Tobias</p>