Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9
This is the forum to discuss the Wrox book Professional SharePoint 2007 Development by John Holliday, John Alexander, Jeff Julian, Eli Robillard, Brendon Schwartz, Matt Ranlett, J. Dan Attis, Adam Buenz, Tom Rizzo; ISBN: 9780470117569
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 7th, 2010, 04:10 PM
Authorized User
Join Date: Dec 2004
Location: Chesterfield, MO, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Question Chapter 6 - assembly name

I followed the steps to create the ApplicationEventReceiver and the console application to deploy the solution, but the console app is throwing an exception. I am guessing it's the way I'm referring to my assembly.

Unhandled Exception: System.InvalidOperationException: Could not load file or assembly 'ApplicationEventReceiver, Version=, Culture=neutral' or one of its dependencies. The system cannot find the file specified.
   at Microsoft.SharePoint.SPEventReceiverDefinition.ValidAssembly()
   at Microsoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()
   at Microsoft.SharePoint.SPEventReceiverDefinition.UpdateInternal(Boolean isMi
   at Microsoft.SharePoint.SPEventReceiverDefinition.Update()
   at Microsoft.SharePoint.SPEventReceiverDefinitionCollection.Add(SPEventReceiv
erType receiverType, String assembly, String className)
   at ConsoleApplication3.Program.Main(String[] args) in C:\Documents and Settings\robbert.vanandel\My Documents\Visual Studio 2008\Projects\ConsoleApplication3\Program.cs:line 20
How do I refer the console application to my ApplicationEventReceiver. I have the applicationeventreceiver inside the ApplicationEventReceiver namespace:

namespace ApplicationEventReceiver
    class ApplicationEventReceiver : SPItemEventReceiver
and my console application looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace ConsoleApplication3
    class Program
        static void Main(string[] args)
            SPSite site = new SPSite("http://oriontest/hiringmanagement/");
            SPWeb web = site.OpenWeb();
            SPList list = web.Lists["Applicant"];

            string assemblyName = "ApplicationEventReceiver, Version=, Culture=neutral, PublicKeyToken=6ac52d8504a20881";
            string className = "ApplicationEventReceiver.ApplicationEventReceiver";

            list.EventReceivers.Add(SPEventReceiverType.ItemAdded, assemblyName, className);

            Console.WriteLine(" - Registered - ");
Your help is appreciated.

Last edited by rvanandel; January 7th, 2010 at 04:21 PM..
  #2 (permalink)  
Old January 7th, 2010, 04:36 PM
Authorized User
Join Date: Dec 2004
Location: Chesterfield, MO, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

Found the answer. Even though the deployment section implies that the console application will deploy the assembly to the GAC, that is not the case. I deployed my code to the GAC and then ran the console application to resolve this issue.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
New to Assembly OnlyHuman925 Assembly Language 4 January 10th, 2010 07:28 AM
Unable to emit assembly: Referenced assembly 'AxInterop.MSCommLib' does not have a s sanderson Visual Basic 2008 Essentials 1 July 16th, 2009 09:20 AM
Converting .NET 2.0 Assembly to .Net 1.x Assembly pskaushik .NET Framework 2.0 1 November 25th, 2006 01:51 PM
Assembly arv1980 .NET Framework 2.0 1 January 15th, 2006 02:12 PM
Chapter 16 - Assembly compiling crazy BOOK: Beginning ASP.NET 1.0 1 October 23rd, 2003 08:58 PM

All times are GMT -4. The time now is 12:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.