Error "Link Required" when linking to the NServiceBus assembly from another project

We are trying to write an application that uses the NServiceBus library in VB.NET. We were implicated in errors similar to the following:

The link required for the assembly is 'NServiceBus, Version = 2.0.0.1071, Culture = neutral, PublicKeyToken = 9fc386479f8a226c', containing the implemented interface NServiceBus.IMessageHandler`1. Add it to your project.

Our project already contains links to NServiceBus.dll and NServiceBus.Core.dll from the same distribution NServiceBus 2.0 RC2.


Steps to play:

  • Create a New VB Class Library Project (.NET 3.5)
  • Add NServiceBus.dll and NServiceBus.Core.dll as links.
  • Put the following code in Class1.vb:

    Imports NServiceBus.Sagas.Impl Class Test Public Function Foo() As SagaMessageHandler Return Nothing End Function End Class 
  • You should now see the compiler error mentioned above.

An identical project written in C # has no compilation errors.


Any ideas on how to solve this problem? (And, yes, my preferred solution is switching to C #, but no, this is not acceptable at the moment.)

+4
source share
2 answers

On suspicion that this is an ILMerge-related issue, I found this post suggesting that signing the assembly may be responsible .

I downloaded the NServiceBus trunk source, opened src / core / NServiceBus.sln and installed each of the projects in the decision to sign the assembly with NServiceBus.snk from the root of the source tree. New DLLS created after restoring NServiceBus fixed compiler errors from my original post.

+3
source

Projects are now firmly marked both on the trunk and branch 2.0.

Hope this helps!

+2
source

Source: https://habr.com/ru/post/1300199/


All Articles