Knowing DLL Debug/release

G

Guest

Hi,
I am loading DLL dynamically. I have no issues with that.
I have one small problem. How do I know dll is compiled in Debug/Realse mode
? I want to load only a release mode DLL.

Please let me know is this possible ?

Kishor
 
D

Damien

kishor said:
Hi,
I am loading DLL dynamically. I have no issues with that.
I have one small problem. How do I know dll is compiled in Debug/Realse mode
? I want to load only a release mode DLL.

Please let me know is this possible ?

Kishor

Once the assembly is loaded, can you use Reflection to look for the
DebuggableAttribute? Please note that I'm not sure that this is the
answer, just an idea. (If you don't want to have the code occupying
memory if it is a debug version, you'll have to create a second
AppDomain and load it there to do the inspection).

Damien
 
S

Steve B.

DEBUG and RELEASE are only configuration options...
So the outputed assembly won't be marked as debug or release unless you find
a way to indicate it. Moreover, custom solution configuration are often a
good way to customize the dev process (adding new conditional attributes,
etc...) and then it is neither debug, neither realease.

I suggest you creating an assembly attribute class that can mark the
assembly as release, and then check if the assembly contains the correct
value.

Then, in your assemblyinfo.cs, you should add something like this :

#if DEBUG
[assembly: ReleaseState(ReleaseStates.Debug)]
#else
[assembly: ReleaseState(ReleaseStates.Released)]
#endif

When loading the assembly in the client app, just check if the assembly has
the correct attribute value.

HTH
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top