Event Receiver breaks Feature

365 views Asked by At

I have a SharePoint project with Event Receivers in it and the solution deploys fine as long as I leave out one specific Event Receiver off the list.

If I add that Event Receiver to the Feature list I get the following error: ‘Error occurred in deployment step ‘Activate Features’:

This project wasn't started by me and I am a bit of a novice when it comes to Event Receiver projects.

1

There are 1 answers

0
calorie712 On

Add this logging method and log messages in the FeatureActivated method. Or you can debug the feature during activation with Visual Studio.

    /// <summary>
    /// Method used for logging errors to a log located at c:\log on the WFE
    /// </summary>
    /// <param name="msg"></param>
    static void LogMessage(string msg)
    {
        StreamWriter wrtr = null;
        try
        {
            wrtr = new StreamWriter("C:\\Logs\\eventreceiver.txt", true);
            wrtr.WriteLine(msg + "--[" + System.DateTime.Now.ToString() + "]" + Environment.NewLine);
            wrtr.WriteLine(Environment.NewLine + "==================================");
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            if (wrtr != null)
            {
                wrtr.Close();
                wrtr.Dispose();
            }
        }
    }