Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
share|improve this question
    
Do you have any comments in your Elements.xml? –  James Love Jun 6 '11 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 Jun 6 '11 at 20:24
    
@James - No, but there are some in my schema.xml, if that makes a difference –  Music Magi Jun 6 '11 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 Jun 6 '11 at 20:32
1  
It sounds more like the EventReceiver XML bit in Elements.xml is screwed in some way. –  James Love Jun 6 '11 at 20:40

2 Answers 2

up vote 3 down vote accepted

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

share|improve this answer
    
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 Jun 6 '11 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 Jun 6 '11 at 20:54
1  
u bastard, i was just typing that ;-) –  Anders Rask Jun 6 '11 at 20:54
1  
Here's a PoSH equivalent too: chrisforbesblogs.net/2010/02/26/… –  James Love Jun 6 '11 at 20:56
    
Thanks for the link guys, but I found it the old-fashioned way using the command prompt –  Music Magi Jun 6 '11 at 21:01

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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