Question

How do I include an unmanaged assembly with the running of a Linqpad query?

I am running the latest beta (v4.42.06). I have added a reference to a working managed assembly via the f4 Query properties. I put in code to access classes and methods from that assembly in Linqpad and when I hit run I get an internal exeception (from my managed assembly not Linqpad) stating that it could not open (really find in this case) a dependent unmanaged assembly which normally resides with the managed assembly in the directory.

Now the unmanaged assembly does exist with the added managed assembly which I had Linqpad browse to, and I can add the unmanaged assembly in the same fashion (f4) but it does not affect the outcome of the process.

When I unit test this module in Visual Studio I append the attribute DeploymentItem to the unit test method and am able to execute the code.

How can I have Linqpad execute with an umanaged assembly deployment item?

Was it helpful?

Solution

Set 'Do not shadow assembly references' to true (in Edit/Preferences/Advanced)

Shadowing means the dlls are copied to another folder and loaded from there. But each dll is copied to a separate folder which means the the managed dll is no longer in the same folder as the unmanaged dll and hence they can not find each other.

By setting the option not to shadow the assembly references, the dlls are loaded from their original locations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top