Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

Posted on by 1,065

Hi all,

Today after generating the Entities(Early bound) file so we can use it in our plugins assembly I started to see the next issue:

"The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'"

"Ambiguity between 'SolutionComponentDefinition.EntityLogicalName' and 'SolutionComponentDefinition.EntityLogicalName'"

Not sure why it appears. I tried to fix it changing the framework, adding OptionSets/Actions file and renaming the namespace but none of them worked. Also, I didn't find much info about this problem so I was wondering if someone has a workaround for this.

Thanks in advance!

*This post is locked for comments

  • Suggested answer
    TFrenki Profile Picture
    TFrenki 5 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    After many years of using CrmSvcUtil without any problems, this problem started occurring to me recently. I am using CRM Service Utility 9.1.0.52 and CRM Online.

    It is rather annoying, so I made a PowerShell script to comment out duplicated properties.

    Hope it will help you too:

    function CommentContents
    {
        param (
        $filePath,
        $startTerm,
        $startTermOffset,
        $endTermOffset
        )
    
        $contents = Get-Content $filePath
        
        #finding the line number of the searchTerm
        $linenumber= $contents | select-string $startTerm -list -SimpleMatch | select-object -First 1
        
        $startLine = $linenumber.LineNumber $startTermOffset
        $endLine = $startLine $endTermOffset
        
        for ($i = 0; $i -le ($contents.Length - 1); $i  ) {
            if ($i -eq $startLine) {
                # Starting comment at the line.
                $contents[$i] = "/*"   $contents[$i]
            }
        
            if ($i -eq $endLine) {
                # Adding close comment at the end of the line.
                $contents[$i] = $contents[$i]   "*/"
                Break 
            }
        }
        
        Set-Content $filePath $contents
    }
    
    Write-Host "Fixing Model.cs by commenting out CustomAPIResponseProperty and CustomAPIRequestParameter properties."
    
    Write-Host "It is recommended to shut down Visual Studio during this operation." -ForegroundColor Yellow
    
    $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
    $modelPath = Resolve-Path -Path "$scriptDir\Model.cs" -Relative
    
    #change the startTerms to match the properties you are having problems with
    echo "Replacing CustomAPIRequestProperty/EntityLogicalName"
    CommentContents -filePath $modelPath -startTerm "/// The logical name of the entity bound to the custom API request parameter" -startTermOffset -2 -endTermOffset 16
    echo "Replacing CustomAPIResponseProperty/EntityLogicalName"
    CommentContents -filePath $modelPath -startTerm "/// The logical name of the entity bound to the custom API response property" -startTermOffset -2 -endTermOffset 16

  • Edwin Hebbink Profile Picture
    Edwin Hebbink 80 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    I would suggest you raise a ticket at Microsoft and in the meantime user one of the older CrmSvcUtil versions, manually edit the context file or use a so called filter in de CrmSvcUtil parameters. All these suggestions can be found in this thread.

  • Fedorov Profile Picture
    Fedorov 338 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    Same here.. Since you wrote this two days ago I assume you haven't solved the issue or?

  • Dipak Jumde Profile Picture
    Dipak Jumde 25 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    Yes

    Exactly doing same but still facing error.

    Thanx for your reply Edwin.

  • Edwin Hebbink Profile Picture
    Edwin Hebbink 80 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    Just to be sure.. You build the new context file with CrmSvcUtil.exe and then replace the context file in your project with the new version and then you build again and the error still appears?

    If that is the case just raise a ticket with Microsoft via admin.powerplatform.com

  • Dipak Jumde Profile Picture
    Dipak Jumde 25 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    I have checked with lower version microsoft.crmsdk.coretools 9.0.3.4 but same error faced in that version too.

  • Edwin Hebbink Profile Picture
    Edwin Hebbink 80 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    Well then I would suggest to try and build the context via an older version of the CrmSvcUtil and try building your project again. Other fixes are described up here like marking our certain parts. I would also mention this to Microsoft via admin.powerplatform.com.. Bye, Edwin

  • Dipak Jumde Profile Picture
    Dipak Jumde 25 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    Hello Edwin

    I am facing same issue with microsoft.crmsdk.coretools 9.1.0.49 version.

    Face an error of  'CustomAPIResponseProperty' already contains a definition for 'EntityLogicalName'

  • Verified answer
    Edwin Hebbink Profile Picture
    Edwin Hebbink 80 on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    I also opened a case with MS and there is something wrong with the newer version CrmSvcUtil.. They told me that a new version will be out somewhere in the fist half of June.. In the meantime just marking out the whole SolutionComponentDefinition class is indeed the only way to go.. Another solution would be creating the context file with a so called filter so you only include the entities you are really using and exclude this SolutionComponentDefinition entity. Also in the latest microsoft.crmsdk.coretools.9.0.3.1.nuget they had included a CrmSvcUtil with version 8.2.0.1 and that should have been something like 9.x.. This is fixed in coretools 9.0.3.4

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: The type 'SolutionComponentDefinition' already contains a definition for 'EntityLogicalName'

    Worked for us aswell!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans