“Could not load file or assembly”/ “or one of its dependencies. The module was expected to contain an assembly manifest.”

风格不统一 提交于 2019-12-07 11:15:50

问题


I have a c# application which uses SharpSVN dll and NServicebus dll,it compile fine but when it is executing(in the time of initialize the bus) it throw the following error

Could not load file or assembly 'file:///C:\Repositories\Repo\hooks\SharpSvn-DB44-20-Win32.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

How can I solve the above problem.

Thank in advance Susanta


回答1:


Exclude the sharpsvn dlls from the NServiceBus assemblyscanning by configuring NSB with a explicit list of assemblies toi scan:

Configure.With("List of your assemblies that contain messagehandlers")...

Make sure to include NServiceBus.core.dll in the list if you're using the Saga feature.

Hope this helps!




回答2:


Susanta,

We recently committed an additional API which can be things easier for you by allowing you to specify which assemblies not to load as follows:

Configure.With(AllAssemblies.Except("SharpSvn-DB44-20-Win32.dll"))... // rest of your config




回答3:


The SharpSvn-DB44-20-Win32.dll is an optional helper dll for SharpSvn.dll. It contains only unmanaged code.

It contains support for directly accessing BDB repositories on the filesystem. You don't need this DLL if you only use fsfs (file://) and/or remote repositories.

The SASL dll is also optional, but you need that when you want to use svn:// repositories.




回答4:


The problem get resolved by using the following bus configuration.

Bus = NServiceBus.Configure.With(typeof(IMessage).Assembly, typeof(CompletionMessage).Assembly) .SpringBuilder().MsmqSubscriptionStorage().XmlSerializer().MsmqTransport() .IsTransactional(true).PurgeOnStartup(false).UnicastBus().ImpersonateSender(false) .LoadMessageHandlers().CreateBus().Start();

Thanks to Andreas




回答5:


I'm not sure if this will help you or not, but I have stumbled on this thread:

http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/9ad17869-63cc-4529-bfaf-9099db500e0d

It appears that a few people have seen this error when building / running assemblies with the same name, so for example:

SomeAssembly.exe
SomeAssembly.dll

Could this be applicable in your case?



来源:https://stackoverflow.com/questions/2005441/could-not-load-file-or-assembly-or-one-of-its-dependencies-the-module-was-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!