I have an ItemAdding event that I am trying to add to a custom content type (inherits from Document). During activation I get the following error:

Error occurred in deployment step 'Activate Features': Could not load file or assembly 'ConnectToPMO.EventReceivers.ProjectDocumentEvents' or one of its dependencies. The system cannot find the file specified

I am running SP2010 on my Windows dev machine (running VS2012 as admin). Here is the code in the featureactivated method:

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        System.Diagnostics.EventLog appLog = new System.Diagnostics.EventLog();
        appLog.Source = "Connect To PMO";
        SPSite site = properties.Feature.Parent as SPSite;
        SPWeb web = site.RootWeb;
        string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName;
        appLog.WriteEntry(String.Format("AssemblyName: {0}", assemblyName));
        const string className = "ConnectToPMO.EventReceivers.ProjectDocumentEvents";
        SPContentType contentType = web.ContentTypes["Project Document"];
        appLog.WriteEntry(String.Format("Content Type: {0} ({1})", contentType.Name,contentType.Id));
        contentType.EventReceivers.Add(SPEventReceiverType.ItemAdding, className, assemblyName);

My event receiver code is as follows:

namespace ConnectToPMO.EventReceivers
    public class ProjectDocumentEvents : SPItemEventReceiver
        public override void ItemAdding(SPItemEventProperties properties)
            SPSite site = properties.Web.Site;
            string url = properties.RelativeWebUrl;
            string projId = Path.GetFileName(url);

            properties.AfterProperties["ContentType"] = "Project Document"; //properties.Web.ParentWeb.ContentTypes[ctId].Name;

            string SQL = "Select * from [PMO_BASE_DATA] where [Project_ID] ='" + projId + "';";
            DataSet ds = PMOHelperMethods.GetDataSet(site, "PMO", SQL);
            properties.AfterProperties["ProjectID"] = projId;
            properties.AfterProperties["ProjName"] = ds.Tables[0].Rows[0]["ProjectName"].ToString();


Through lots of searching, I have confirmed the following things:

  • The WSP file is being properly deployed to the GAC
  • Using ILDSAM I can open the WSP and within the dll and see ConnectToPMO.EventReceivers.ProjectDocumentEvents
  • I've added event receiver logging to validate that the doc type is correct as well as the assembly name
  • I've reset IIS several times, exited VS, etc.

If anyone has any thoughts on what I may have missed or what I can try, it would be greatly appreciated.


  • Use the Fusion log to find out, which assembly could not be loaded. See this post for detail how it works: blogs.msdn.com/b/junfeng/archive/2004/02/14/72912.aspx. Don't forget to restart your processes (run IISRESET, restart OWSTIMER and VS) before trying the activation again. – pholpar Feb 26 '15 at 19:52
  • Thanks for your reply. Unfortunately, doing the things you suggested had no impact (I also rebooted). When I ran Fusion I had no error logs. – Les Zatony Feb 26 '15 at 23:30
  • Does the directory you configured for Fusion logs (LogPath) exist? If not, Fusion won't auto-create it as far as I remember. If it does exist, you can configure Fusion to log all binding events (ForceLog), not only failures, just to be sure the logging is working as expected. – pholpar Feb 27 '15 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.