在这个问题上,当我的功能中没有EventReceiver时,项目会构建和部署,当我有了EventReceivers时,项目就会失败。我不完全确定FileNotFoundException指的是哪个文件
visual studio 中出现错误
Error 1 Error occurred in deployment step 'Activate Features': Failed to load receiver assembly "Decisions.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d09acb153961cfd" for feature "Decisions.Features_DeployDecisionCommittee" (ID: 779492d8-f053-45ce-8340-5fa6d7f87a90).: System.IO.FileNotFoundException: Could not load file or assembly 'Decisions.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d09acb153961cfd' or one of its dependencies. The system cannot find thefile specified.
File name: 'Decisions.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d09acb153961cfd'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
=== Pre-bind state information ===
LOG: DisplayName = Decisions.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d09acb153961cfd
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/
LOG: Initial PrivatePath = C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEExtensionsMicrosoftSharePointVstspCache7880
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEExtensionsMicrosoftSharePointvssphost5.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config.
LOG: Post-policy reference: Decisions.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8d09acb153961cfd
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
0 0 Decisions.Features
组装Binging日志查看器
*程序集装订日志条目(2014年4月25日,11:11:41)*操作失败。绑定结果:hr=0x8007002。系统找不到指定的文件。
从C:\Windows\Microsoft加载程序集管理器。NET\Framework64\v4.0.30119\clr.dll在可执行文件C:\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SharePoint\vssphost5.exe下运行---下面是详细的错误日志。
===预绑定状态信息===日志:DisplayName=决策。Features,Version=1.0.0.0,Culture=neutral,PublicKeyToken=8d09acb153961cfd(详细说明)日志:Appbase=file:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/日志:初始PrivatePath=C:\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SharePoint\VsspCache7880日志:动态基=NULL日志:缓存基=NULL日志:AppName=vssphost5.exe
正在调用程序集:(未知)
日志:此绑定在默认加载上下文中启动。日志:使用应用程序配置文件:C:\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SharePoint\vssphost5.exe.Config日志:使用主机配置文件:日志:使用C:\Windows\Microsoft中的计算机配置文件。NET\Framework64\v4.0.30119\config\machine.config。日志:政策后参考:决策。Features,Version=1.0.0.0,Culture=neutral,PublicKeyToken=8d09acb153961cfd日志:GAC查找不成功。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/Disions。功能。DLL。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/Disions。特点/决策。功能。DLL。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/VstspCache7880/Decisions。功能。DLL。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/VstspCache7880/Decisions。特点/决策。功能。DLL。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/PublicAssemblies/Decisions。功能。DLL。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/PublicAssemblies/Decisions。特点/决策。功能。DLL。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/Disions。功能。EXE。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/Disions。特点/决策。功能。EXE。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/VstspCache7880/Decisions。功能。EXE。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/VstspCache7880/Decisions。特点/决策。功能。EXE。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/PublicAssemblies/Decisions。功能。EXE。日志:正在尝试下载新URLfile:///C:/Program文件(x86)/Microsoft Visual Studio 11.0/Common7/IDE/Extensions/Microsoft/SharePoint/PublicAssemblies/Decisions。特点/决策。功能。EXE。日志:所有探测URL都尝试过,但都失败了。
帮助
这对我很有用,
First resolution:
· Retract the Solution/WSP in VS.
· Close VS.
· Reopen VS and deploy the Project.
Second resolution:
If closing VS after retraction doesn't solve the problem then a larger workaround is:
· Redeploy the project -> This will show an error during feature activation.
· Go to SharePoint UI and Activate and then Deactivate the deployed feature that was showing activation error in VS.
· Retract the Solution/WSP in VS.
· Close VS.
· Reopen VS and deploy the Project.
http://support.microsoft.com/kb/2022443
这对我有效。
在项目上单击鼠标右键,然后选择属性。在"属性"菜单中,选择"签名"。在"签名"选项卡中,在"选择强名称密钥文件"下,选择"新建"并键入密钥名称。然后选择不需要密码。完成所有操作后,重新生成文件,然后就可以开始部署了。
这对我很有效:在程序集信息中更改VS项目的版本。例如,我将程序集和文件版本更改为1.1.0.0,而不是1.0.0.0。
已部署,没有问题。
之后,我可以将其设置回1.0.0.0,然后继续部署,不会出现错误或问题。。。
另一个帮助我的解决方案:转到要部署到的站点,然后从UI激活功能。从Visual Studio重新部署。