reflection - Loading different assemblies at compile-time based on Build Target -


I want to load one of the four separate C # assemblies based on what the build target is. It's going to be in a webservice with .NET Framework 3.0.

Possibilities:

32-bit debug: AmtApiWrapper32d.dll

32-bit release: AmtApiWrapper32.dll

64-bit debug : AmtApiWrapper64d.dll 64-bit release: AmtApiWrapper64.dll

Those wrappers are a separate C ++ project that wrap the C natial DLL that I wrote. C / C ++ is my normal platform, please forgive me if this is a problem.

All wrapper dlls have exact same functions and similar prototypes. It is used for many other purposes besides, so long as it is not really awesome, setup remains the same.

So, I want to load one of them on compile time. I've noticed stuff like Reflection, GetDelegateForFunctionPointer, and some other stuff, and all of these are identical but more complex for the same simple task. Any suggestions? Thank you

This is definitely possible, but you have to be loaded into the build file.

You want something like this:

  & item number = '$ 1 (' configuration) '== '32 -bit debug' "& gt; & Lt ; Include references = "AmtApiWrapper32d">       Item group status = "'$ (configuration)' == '64-BT release '"> = "AmtAp IWrapper64 "& gt; ItemGroup & gt;  

I suggest that you are working a without any condition, and then exactly the same Look at how the context looks.

This happens when you want to add it as a build-time reference, if you want to use it in P / Invocation Declaration, simply Use #if SYMBOL / #endif around the appropriate attribute.


Comments