2

I have created a solution package for Sharepoint 2007 and have installed and deployed it on a development server. However, when I go to activate it through Site Features, I'm given a lovely page of an error stack:

Cannot insert the value NULL into column 'Assembly', table 'wss_content_rginfonet_bodsp2007app1.dbo.EventReceivers'; column does not allow nulls. INSERT fails. 
Cannot insert the value NULL into column 'Assembly', table 'wss_content_rginfonet_bodsp2007app1.dbo.EventReceivers'; column does not allow nulls. INSERT fails. 
The statement has been terminated. 
The statement has been terminated.   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) 
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) 
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() 
   at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command) 
   at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionContentTypeAndEventReceiverBindings(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce) 
   at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce) 
   at Microsoft.SharePoint.SPFeature.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce) 
   at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce) 
   at Microsoft.SharePoint.SPFeatureCollection.AddInternal(Guid featureId, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly) 
   at Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId) 
   at Microsoft.SharePoint.WebControls.FeatureActivator.BtnActivateFeature_Click(Object objSender, EventArgs evtargs) 
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e) 
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) 
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) 
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) 
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) 
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I'm not quite sure how to decipher this, but from my understanding it's saying that the application is attempting to insert a NULL event receiver into the event receivers table. Any help is greatly appreciated as usual!

Cheers~

Elements.xml (renamed to ListManifest.xml):

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListTemplateId="101">
        <Receiver>
            <Name>AddedEventHandler</Name>
            <Type>ItemAdded</Type>
            <SequenceNumber>10000</SequenceNumber>
            <Class>ChangeContentTypeEventHandler.ChangeContentTypeEventHandler</Class>
            <Data></Data>
            <Filter></Filter>
        </Receiver>
    </Receivers>
</Elements>

manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
  SolutionId="F9850E13-81B6-47E1-BBC6-42AC70A903C3" >
    <FeatureManifests>
        <FeatureManifest Location="List\Feature.xml"/>
    </FeatureManifests>
    <Assemblies>
       <Assembly DeploymentTarget="GlobalAssemblyCache"     Location="ChangeContentTypeEventHandler.dll"/>
    </Assemblies>
</Solution>

deploy.ddf:

.OPTION Explicit ; Generate errors
.Set DiskDirectory1="..\bin"
.Set CabinetNameTemplate="ChangeContentTypeEventHandler.wsp"

manifest.xml
.Set DestinationDir="List\ListTemplates"
List\ListTemplates\ListManifest.xml ; specify cab file name
.Set DestinationDir="List\Messages"
List\Messages\schema.xml
.Set DestinationDir="List"
List\Feature.xml
.Set DestinationDir=. 
..\bin\ChangeContentTypeEventHandler.dll ChangeContentTypeEventHandler.dll
6
  • Do you have any comments in your Elements.xml?
    – James Love
    Commented Jun 6, 2011 at 20:21
  • 1
    Do you have an event receiver defined somewhere that hasn't been written or compiled into the package? It wouldn't try to insert an event receiver unless you've got one referenced somewhere.
    – webdes03
    Commented Jun 6, 2011 at 20:24
  • @James - No, but there are some in my schema.xml, if that makes a difference
    – Music Magi
    Commented Jun 6, 2011 at 20:31
  • 1
    @Web The feature I'm deploying is an event receiver that overrides the ItemAdded event to change the content type. This is maybe the 3rd or 4th iteration of this feature that i've installed/uninstalled however. Is it possible the other event receivers (although not activated) could be getting in the way?
    – Music Magi
    Commented Jun 6, 2011 at 20:32
  • 1
    It sounds more like the EventReceiver XML bit in Elements.xml is screwed in some way.
    – James Love
    Commented Jun 6, 2011 at 20:40

2 Answers 2

3

Don't you need an Assembly node in your Elements.xml?

6
  • I was just looking at that. I removed it when I made the deployment WSP to add the DLL to the GAC automatically, but maybe I should add it in. I'm just trying to find out how to get the publickeytoken
    – Music Magi
    Commented Jun 6, 2011 at 20:52
  • 1
    Follow this to add a shortcut to your Visual Studio External Tools menu: blogs.msdn.com/b/kaevans/archive/2008/06/18/… - pretty invaluable.
    – James Love
    Commented Jun 6, 2011 at 20:54
  • 1
    u bastard, i was just typing that ;-) Commented Jun 6, 2011 at 20:54
  • 1
    Here's a PoSH equivalent too: chrisforbesblogs.net/2010/02/26/…
    – James Love
    Commented Jun 6, 2011 at 20:56
  • Thanks for the link guys, but I found it the old-fashioned way using the command prompt
    – Music Magi
    Commented Jun 6, 2011 at 21:01
2

Looks like you are missing the <assembly>your.dll</assembly> element in your Receiver element.

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.