If you are writing some non-shipping app and doing this as part of some
internal work then try this...
With CLR 1.0, the debug assemblies have a custom attribute
System.Diagnostics.DebuggableAttribute. The release assemblies do not have
this attribute. The attribute is a runtime JIT directive. This is a very
unreliable solution because some body writing a release dll could put this
attribute on the assembly as well. The attribute is added to the debug
assembly only if the assembly was built with some compiler options. And
that is why I insist that you wouldn't want to ship your work with this
solution.
If you have a later version of the CLR then find where ildasm.exe is on
your machine. Run it on the dll. Look at the assembly manifest of a debug
and release dlls. See what you find different. The new versions have
replaced the System.Diagnositics.Debuggable with
System.Runtime.CompilerServices.
Again, I repeat, this is not a solid solution. But if you are working on
some internal tool and need a quick and dirty solution it might help.
--------------------
Reply-To: "Baskar RajaSekharan" <rb*@srasys.co.in>
From: "Baskar RajaSekharan" <rb*@srasys.co.in>
References: <#B**************@tk2msftngp13.phx.gbl>
<Oe**************@TK2MSFTNGP09.phx.gbl>
<ux**************@TK2MSFTNGP12.phx.gbl>
<uv**************@tk2msftngp13.phx.gbl>Subject: Re: Checking compile mode (Was: doubt)
Date: Wed, 5 Nov 2003 14:30:39 +0530
Lines: 85
Organization: SRA System Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <uM**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: 203.199.194.34
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:196847
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
How to do that in Run Time? I hope you are not properly understand My
Qustion. If repeat the Qustion.
In C-Sharp I create two Component and compiled one in Release Mode and
another one is in compile Mode. Assume that the two components are
A.dll = Debug Mode
B.dll = RelatesMode
I want to write one method which will accept the dll path as a input and
return it's compiled in Debug mode or release mode. based on the Result i
amgoing to do some operations.
How the above one is possible. Can you give me some sample code.
Regards,
R.Baskar
"Muscha" <mu****@no.spam.net> wrote in message
news:uv**************@tk2msftngp13.phx.gbl... > Thank you for your reply. How to check the Configuration Managerthrough > code and findout it's debug or Release. Can you give
> me some sample code?
#if (DEBUG)
Console.WriteLine("Debug mode");
#elif (TRACE)
Console.WriteLine("Release mode");
#endif
Configuration Manager -> Open Visual Studio, right click on the project
file, Properties.
/m
>
> "Muscha" <mu****@no.spam.net> wrote in message
> news:Oe**************@TK2MSFTNGP09.phx.gbl...
> > The Debug/Release mode is just a name, you can call them Jon/Bob it
doesn > > matter. What matter is the configuration underneath it. Check the
> > configuration manager to find out.
> >
> > To answer your question, yes you can by default if you didn't changeany > the
> > configuration settings. Example:
> >
> > #if (DEBUG)
> > Console.WriteLine("Debug mode");
> > #elif (TRACE)
> > Console.WriteLine("Release mode");
> > #endif
> >
> >
> > HTH,
> > /m
> >
> > PS: please start a new thread and change the subject line! It's
really > > annoying.
> >
> > "Baskar RajaSekharan" <rb*@srasys.co.in> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > In C-sharp, I wnat to know whether the Component is compiled in
Debug > > Mode
> > > or Run Mode through Code. How is it possible?
> > > Is there any way to Access the Config file and check? Please letme > know
> > > with example
> > >
> > >
> >
> >
>
>
Rakesh, EFT.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm