Check out Simon Mourier's answer here
https://stackoverflow.com/questions/60540720/how-do-i-expose-a-netstandard2-0-library-with-com-for-use-in-vb6

On Thu, Oct 8, 2020 at 9:22 AM Greg Keogh <gfke...@gmail.com> wrote:

> Folks, this problem is a stinker that I don't think anyone will be able to
> help with, but sometimes just writing down the problem can help clear the
> mind.
>
> We're developing a set of C# library projects that target both
> netstandard2.0 and net461. By simply changing some Stream classes they can
> switch between files/folders or Azure containers/blobs (a neat classic
> example of abstracted "file" processing). One of our guys wants to call the
> libraries from inside Excel via VBA, so I created a thin COM call wrapper
> Framework 4.6.1 project which works nicely and I can drive it all from a VB
> script file.
>
> Except ... here's the stinker ... if I switch to using the Azure streams
> then I get runtime crash:
>
> System.Threading.Tasks.Extensions: Could not load file or assembly
> 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system
> cannot find the file specified.
>
>
> I've tried config redirects, Nuget packages, different Framework targets,
> and I've watched it probing for the assembly via procmon, but absolutely
> nothing makes any difference. The Unsafe library being used is actually
> 4.0.5.0 but I can't redirect to it.
>
> There are so many tangled links in the chain that it's hard to tell which
> one is breaking. The most suspicious thing is the tiny Azure stream library
> targeting 4.6.1, it uses the Azure.Storage.Blobs package which depends on
> netstandard2.0 and therefore drags in a whopping 108 of the "shim"
> libraries, including the Unsafe one. This DLL hell between Full and Core
> Frameworks is hell.
>
> *Greg K*
>

Reply via email to