为什么我调试时我的项目的程序集从程序包中丢失了?
我有一个SharePoint项目,我已经调试了一段时间没有问题。为什么我调试时我的项目的程序集从程序包中丢失了?
今天我添加了一个功能接收器到项目的唯一功能。我还没有更改Visual Studio默认添加的空接收器类的任何内容。
“Package”命令现在会生成一个包含我的项目DLL文件的包(正如您所期望的那样 - 添加一个功能接收器不应该改变这一点)。
然而,当我调试,生成的包确实不包括我的项目的DLL文件,并部署努力失败,出现以下错误:
Error occurred in deployment step 'Add Solution': Failed to load receiver assembly "ABC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2377fad544a7c307" for feature "ABC_XYZ Feature" (ID: dca34989-a2f2-413b-b5c4-958e0bbb84ef).: System.IO.FileNotFoundException: Could not load file or assembly 'ABC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2377fad544a7c307' or one of its dependencies. The system cannot find the file specified. File name: 'ABC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2377fad544a7c307' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 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()
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
删除功能接收器可以让我无需再次调试问题,但只要我重新添加功能接收器,问题就会返回。
我试过清洗和重建,然后调试,但错误不会消失,除非/直到我删除功能接收器。
为什么我的项目的组件获得包括在包中,当我使用“打包”命令,而不是当我使用了“启动调试”命令,怎么样添加功能接收器会导致这样的事情发生?
我不知道是什么导致了它的发生,但是当我手动清除obj和bin目录时问题就消失了。下面是我遵循从国家获得的步骤列举的问题调试成功瓦特/功能接收器:
- 删除功能接收
- 清洁液
- 关闭Visual Studio的
- 删除的SharePoint项目在Windows资源管理器中的obj文件夹
- 在Windows资源管理器中删除SharePoint项目的bin文件夹
- 打开Visual Studio并重新添加功能部件接收器
- 开始调试
接受的答案对这个问题并没有为我工作。
下面做工作:
...simply changing out the project’s strong key assembly worked in this particular case. If you haven’t had to change this before, it is under the properties of the project -> Signing. Under ‘Choose a strong name key file’, select New. The password is optional.
由于这一博客帖子:Farm Solution Deployment Problems
也没有为我工作,但新的关键解决方案做到了。谢谢,杰伊! – Sergey 2014-07-09 13:38:14
我也一样,这个解决方案工作。做得好! – 2014-07-16 14:53:07
为我工作,谢谢 – 2016-07-27 16:04:11
我试图在Visual Studio去解决上点击右键 - 属性。 在应用程序,程序集信息,然后我提出了“最低1”(从1.0.0.0到1.0.0.1)的汇编和文件版本。 然后有可能部署(并主要激活功能)解决方案“进入WebApplication”
+1因为,针对所有逻辑,这是有效的。怎么样?这部分可以编辑出来吗? (我意识到让Visual Studio运行导致obj文件夹立即重新生成。) – 2014-03-12 17:34:21
我创建了这个答案b/c我不明白它为什么起作用,而且这是一个我不想重复的故障排除工作。如果我发现它是不必要的,我一定会编辑。 – lance 2014-03-13 03:31:42
它的工作,但有线如何修复。 – Prageeth 2015-03-02 08:15:01