See Compiler-Based .NET Assembly

I need to add a reference to another assembly in my C # project based on some compiler like directive #if

. For example, I want to add a link to a logger DLL to my project only when I need it. Is it possible?

+3


source to share


1 answer


As far as I know, referencing an assembly that is not used by AT ALL is not a problem. You can even save it as a link.

As long as your code doesn't run the loadable assembly, you don't need to have this file.



I would suggest that you need to check if you really need this, and if it can be worked around, create interfaces and load the assembly dynamically (using Assembly.LoadFrom

).

+3


source







All Articles