“Could not load file or assembly”/ “or one of its

2019-05-05 05:46发布

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

5条回答
Root(大扎)
2楼-- · 2019-05-05 06:10

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楼-- · 2019-05-05 06:11

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

查看更多
霸刀☆藐视天下
4楼-- · 2019-05-05 06:19

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.

查看更多
狗以群分
5楼-- · 2019-05-05 06:28

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?

查看更多
来,给爷笑一个
6楼-- · 2019-05-05 06:34

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!

查看更多
登录 后发表回答