Question

I have a problem when activating a Site scoped feature. Every time I try to activate the solution with STSADM or Powershell I get this error:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN>STSA
DM.EXE -o activatefeature -url http://example.sp2012.com -id aad760ac-22ff-4873-
acb3-b5b727de032d

Failed to load receiver assembly "Customer.Example.Homepages_v1, Version=1.0.0
.0, Culture=neutral, PublicKeyToken=00eb5deafe22c91f" for feature "Customer.Exam
ple.Homepages_v1" (ID: aad760ac-22ff-4873-acb3-b5b727de032d).: System.IO.F
ileNotFoundException: Could not load file or assembly 'Customer.Example.Homepage
s_v1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=00eb5deafe22c91f' or on
e of its dependencies. The system cannot find the file specified.
File name: 'Customer.Example.Homepages_v1, Version=1.0.0.0, Culture=neutral, P
ublicKeyToken=00eb5deafe22c91f'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boo
lean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence
 assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence as
semblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject
()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].

The Assembly Deployment Target is set to WebApplication an when i deploy it with Visual Studio 2010 everything works fine, but when i do it manual with the console i get the error?

Is this feature receiver in the same assembly as other parts of my solution?

Was it helpful?

Solution

If the assembly contains any event or feature receivers then the deployment target should be Global Assembly Cache. And if you deploy the solution using a command line then you should start a new instance of that before activating the feature (this is most important when you get to upgrading) as an old version of the dll can't be unloaded.

OTHER TIPS

  1. Remove feature receiver
  2. Clean solution
  3. Close Visual Studio
  4. Delete SharePoint project's obj folder in Windows Explorer
  5. Delete SharePoint project's bin folder in Windows Explorer
  6. Open Visual Studio and re-add feature receiver
  7. Start Debugging
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top