2010-03-03 2 views
0

gacutil.exe 및 sn.exe를 사용하여 HelloWorld.dll을 GAC로 가져 와서 SharePoint에 업로드 할 수 있습니다. 기능 목록에서 확인할 수 있습니다.HelloWorld.dll SharePoint 기능 활성화 오류

Feature '79bc44ea-93f5-4886-8784-8f3fbd1dfa48' could not be installed because the loading of  event  receiver assembly "HelloWorld, Version 1.0.0.0, Culture=neutral,  PublicKeyToken=b169cb5c722a4763" failed: System.IO.FileLoadException: Could not load file or assembly 'HelloWorld\, Version 1.0.0.0\, Culture\=neutral\, PublicKeyToken\=b169cb5c722a4763' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) 
File name: 'HelloWorld\, Version 1.0.0.0\, Culture\=neutral\, PublicKeyToken\=b169cb5c722a4763' 
at System.Reflection.AssemblyName.nInit(Assembly& assembly, Boolean forIntrospection, Boolean  raiseResolveEvent) 
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
at System.Reflection.Assembly.Load(String assemblyString) 
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() 

이 초보자 기능이며, 내 feature.xml 파일 이벤트 핸들러가 있습니다 : 나는 그것을 활성화하려고 할 때 그러나, 내가 얻을

<Feature 
Id="79bc44ea-93f5-4886-8784-8f3fbd1dfa48" 
Title="Hello World Feature" 
Description="This is my first custom Featuree" 
Scope="Web" 
Hidden="False" 
ImageUrl="menuprofile.gif" 
ReceiverAssembly="HelloWorld, Version 1.0.0.0, Culture=neutral, PublicKeyToken=b169cb5c722a4763" 
ReceiverClass="HelloWorld.FeatureReceiver" 
xmlns="http://schemas.microsoft.com/sharepoint/"> 

<ElementManifests> 
<ElementManifest Location="elements.xml"/> 
</ElementManifests> 

</Feature> 

내 elements.xml을 파일 :

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
<CustomAction 
Id="SiteActionsToolbar" 
GroupId="SiteActions" 
Location="Microsoft.SharePoint.StandardMenu" 
Sequence="100" 
Title="Hello World" 
Description="A custom menu item added using a Feature" 
ImageUrl="_layouts/images/menuprofile.gif"> 
<UrlAction Url="http://msdn.microsoft.com"/> 
</CustomAction> 
</Elements> 

sn.exe를 실행하면 dll이 유효하며 GAC에 있습니다. 이벤트 처리기로 인해, 나는 dll에 있다고 가정하는 .cs 파일을 가지고 있습니까? Feature "Id"를 구성하면 중요합니까, 사용중인 코드 예제에서 번호를 복사했습니다.? 내가 볼 수있는 다른 일반적인 영역은 무엇입니까?

다음은 수신기 클래스의 :

using System; 
using Microsoft.SharePoint; 

namespace HelloWorld 
{ 
public class FeatureReceiver : SPFeatureReceiver 
{ 
    public override void  FeatureInstalled(SPFeatureReceiverProperties properties) 
    { 
    } 
    public override void FeatureUninstalling(SPFeatureReceiverProperties properties) 
    { 
    } 
    public override void FeatureActivated(SPFeatureReceiverProperties properties) 
    { 
     Console.WriteLine("...in HelloWorld.FeatureActiviated()..."); 
     SPWeb site = (SPWeb)properties.Feature.Parent; 
     site.Properties["OriginalTitle"] = site.Title; 
     site.Properties.Update(); 
     site.Title = "Hello World"; 
     site.Update(); 
    } 
    public override void FeatureDeactivating(SPFeatureReceiverProperties properties) 
    { 
     SPWeb site = (SPWeb)properties.Feature.Parent; 
     site.Title= site.Properties["OriginalTitle"] = site.Title; 
     site.Update(); 
    } 
} 
} 
+1

수신기 클래스의 코드를 게시 할 수 있습니까? –

+0

나는 그것을 ..... 추가했다. – bmw0128

답변

0
  1. 기능 ID가 고유해야합니다, 그게 사실. 그리고 당신은 그것을 yorself로 만들거나 guidgen.exe를 사용할 수 있습니다 (C : \ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ bin \ guidgen.exe에 있음)
  2. WSPBuilder Visual Studio의 경우 유효한 feature.xml과 피처 수신자 코드에 대한 유효한 클래스를 자동으로 제공하는 "수신자 기능"이라는 새 항목을 프로젝트에 추가하십시오.
관련 문제