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();
}
}
}
수신기 클래스의 코드를 게시 할 수 있습니까? –
나는 그것을 ..... 추가했다. – bmw0128