0

I have a custom dll:

C:\Custom Libraries\Custom.dll

I have a c# project that references this library.

I want the reference to be absolute; and for local copies to be false.

I have changed the reference type to local copy false.

When I run my application it will fail to run - this is obvious as my application doesnt know where to look to resolve the missing dll.

How can I get my application to search C:\Custom Libraries for my dll?

So far I have only found ways to change the search path if the directory remains relative to my applications base directory...

As this dll is used in multiple projects - I dont want multiple local versions for each application.

Danaldo
  • 112
  • 4
  • 17
  • Use [probing](https://msdn.microsoft.com/en-us/library/4191fzwb(v=vs.110).aspx)? – Fᴀʀʜᴀɴ Aɴᴀᴍ Dec 23 '15 at 16:24
  • I thought probing only worked with relative directories: https://msdn.microsoft.com/en-us/library/4191fzwb(v=vs.110).aspx – Danaldo Dec 23 '15 at 16:33
  • Any reason you aren't loading it into the GAC? – dbugger Dec 23 '15 at 16:48
  • Also, is your `Custom.dll` architecture matching that of the C# app? For example, a 64-bit app with utterly fail to load a 32-bit DLL, and vice versa. – Chris O Dec 23 '15 at 18:55
  • Its not an architecture issue as it will work with local copies true. I'd rather not install it to GAC if I can help it as I may run in to issues with IT. – Danaldo Dec 24 '15 at 10:00

1 Answers1

0

You could use reflection at runtime, just as Dark Falcon demonstrates here

There is nothing intrinsically incorrect about using a local copy.

Another attempt is to store your *.dll in the global assembly cache.

Community
  • 1
  • 1
sapbucket
  • 6,795
  • 15
  • 57
  • 94
  • It would mean a rewrite if I were to use Dark Falcons method. Plus it would mean sacrificing c#'s intellisense. I dont think it provides any advantage to not using local copies - which I would still prefer to avoid. – Danaldo Dec 24 '15 at 10:10
  • You might consider using post-build events with xcopy commands. That way you can customize where *.dlls are stored. But even then I would allow local copy...I cannot imagine why that would be a problem. Good luck! – sapbucket Dec 28 '15 at 21:40