I have create event receiver in dev environment and its working fine. But when try to add in production facing:

PS C:\Users\spfarmadmin> $spWeb = Get-SPWeb -Identity http://site/hr
PS C:\Users\spfarmadmin> $spList = $spWeb.Lists["EmpEntyExit"]

PS C:\Users\spfarmadmin> $spEventReceiver = $spList.EventReceivers.Add()

PS C:\Users\spfarmadmin> $spEventReceiver.Assembly = "$SharePoint.Project.Assemb

PS C:\Users\spfarmadmin> $spEventReceiver.Class = "my_STG.AddTaskand_SubTask

PS C:\Users\spfarmadmin> $spEventReceiver.Name = "AddTaskand_SubTaskItemAdded"

PS C:\Users\spfarmadmin> $spEventReceiver.Type = 10002

PS C:\Users\spfarmadmin> $spEventReceiver.SequenceNumber = 1000

PS C:\Users\spfarmadmin> $spEventReceiver.Synchronization = 1

PS C:\Users\spfarmadmin> $spEventReceiver.Update()

Exception calling "Update" with "0" argument(s): "Could not load file or assembly '.Project.AssemblyFullName$' or one of its dependencies. The system cannot find the file specified." At line:1 char:1 + $spEventReceiver.Update() + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException

PS C:\Users\spfarmadmin>

  • You can try providing assembly name like $spEventReceiver.Assembly = "YourAssembly, Version=, Culture=neutral, PublicKeyToken=5eff...(here goes assebly's token" "$SharePoint.Project.Assemb lyFullName$" is resolved when you use visual studio. Commented Oct 24, 2016 at 20:16

1 Answer 1


$SharePoint.Project.AssemblyFullName$ is a replacement token that VisualStudio will automatically replace with the real 4-part name of your assembly when you build the project.

What you can do is add a little Powershell snippet as an "external tool" in your Tools menu in VisualStudio which will output the 4-part assembly full name to the Output window in VS. Link here to the instructions on how to do that.

You can then use that information (the real 4-part name) in your Powershell above for adding the event receiver in production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.