Home All Groups Group Topic Archive Search About

Knowing DLL Debug/release

Author
11 Jul 2006 10:04 AM
kishor
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

Author
11 Jul 2006 10:23 AM
Damien
kishor wrote:
> 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
Author
11 Jul 2006 12:05 PM
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

"kishor" <kis***@discussions.microsoft.com> a écrit dans le message de news:
306F9053-DEA1-478C-B6B7-C62C9D04E***@microsoft.com...
Show quote
> 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
>

AddThis Social Bookmark Button