locked
Event Receiver error RRS feed

  • Question

  • Hi,

    I used the following powershell to deploy an event receiver which targets a particular list, however, I am receiving the following error message when I try to fire the event receiver. Also, when I check the PublicKeytoken on the actual dll in the GAC, the number is different from below. Can anyone tell me how to fix this issue?

    ----------------------------------------------------------Error ---------------------------------------------------------------------------

    Event manager error: Could not load file or assembly 'ContractHubEventReceiver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6263e36ca7fde497' or one of its dependencies. The system cannot find the file specified.

    ------------------------------------------------------Powershell--------------------------------------------------------------------------

    Add-SPSolution -LiteralPath C:\webparts\ContractHubEventReceiver.wsp

    Install-SPSolution -Identity ContractHubEventReceiver.wsp -GACDeployment -CompatibilityLevel 15

    thanks,

    Sherazad


    Sherazad

    Monday, May 16, 2016 7:46 PM

Answers

All replies

  • 6263e36ca7fde497 is different from which is in GAC?

    how did this happen?

    you can try delete the dll from GAC and redeploy the solution


    顺其自然地勇往直前!—Justin Liu

    Tuesday, May 17, 2016 1:00 AM
  • Hi,

    Please check the following threads with similar issue.

    http://sharepoint.stackexchange.com/questions/45219/error-loading-and-running-event-receiver-could-not-load-file-or-assembly-custom

    https://blogs.msdn.microsoft.com/sharepoint_bar__grill/2011/04/09/delete-orphaned-event-handler-through-powershell/

    Or try to use the following PowerShell to delete the event receiver, then redeploy it.

    $var = Get-SPSite -limit All | Get-SPWeb -limit all | % {$_.EventReceivers} | where {$_.Assembly -like "*ContractHubEventReceiver*"} | Select Assembly
    $var | % {$_.Delete()}

    Best Regards,

    Dennis


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by Patrick_Liang Thursday, May 26, 2016 10:07 AM
    • Marked as answer by Patrick_Liang Thursday, June 2, 2016 1:24 AM
    Tuesday, May 17, 2016 2:57 AM
  • Hi,

    You might have created the new solution and copied the code from existing event receiver to your new one and tried deployment.

    In this case, feature id shares the same with two solution and subsequently orphaned on continuous deployment. Retract the earlier solution from the farm and ensure its the assembly file got removed from the GAC and the use the powershell command given by Dennis .

    Now you can rectify this, change the feature id on your new solution and deploy.


    Murugesa Pandian | MCPD | MCTS | SharePoint 2010 |


    Tuesday, May 17, 2016 4:13 AM