473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I determine the build mode using reflection?

My company is setting up a deployment process for implementing .NET Windows
applications. One of the standards we want the process to enforce is
verifying that the assembly is built in release mode. Is there a way to
check an assembly to determine if it was built in release mode? The
deployment application will not have access to source code, just the compiled
assembly, so I am assuming I will need to use reflection. However, I have
not found anything in the System.Reflection namespace that provides the build
mode. Any ideas?

Jul 25 '05 #1
6 2014
Jan
The pre-compiler definitions are are only available at compile time.

Anyway, (using default project settings) there is no difference between
a Release and a Debug build since the Symbol Store information is
stored in a separate .pdb file.

So why exactly have you choosen to enfore this policy?

Jan

Jul 25 '05 #2
"Jan" <ja***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
The pre-compiler definitions are are only available at compile time.

Anyway, (using default project settings) there is no difference between
a Release and a Debug build since the Symbol Store information is
stored in a separate .pdb file.


With the default settings, Release is optimized and Debug isn't.

Jul 25 '05 #3
"Brad" <br********@newsgroup.nospam> wrote in message
news:E3**********************************@microsof t.com...
My company is setting up a deployment process for implementing .NET Windows applications. One of the standards we want the process to enforce is
verifying that the assembly is built in release mode. Is there a way to
check an assembly to determine if it was built in release mode? The
deployment application will not have access to source code, just the compiled assembly, so I am assuming I will need to use reflection. However, I have
not found anything in the System.Reflection namespace that provides the build mode. Any ideas?


Hi Brad, I know this is possible because I had to do it 2 or 3 years ago. My
memory is getting progressively worse these days, but I'm pretty sure I used
the DebuggableAttribute. Have a look at it, it allows you to check whether
the code is JIT optimised or not. I'm pretty sure that this attribute is
added to an assembly automagically on a debug build. So a wee bit of
reflection should give you the information you need.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Jul 26 '05 #4
Jan
But do you know what optimizations those are? I've profiled debug and
release on a couple of applications and there's been no performance
gain but realease was smaller. So the optimatization is probably space
not speed.

Jul 26 '05 #5
Jan
You're totally right [assembly: Debuggable(true, true)] is set if it's
a debug build.
You learn something new everyday!

Jan

Jul 26 '05 #6
"Jan" <ja***********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
But do you know what optimizations those are? I've profiled debug and
release on a couple of applications and there's been no performance
gain but realease was smaller. So the optimatization is probably space
not speed.


You probably weren't doing anything intensive enough for it to matter. Some
more complex C# apps I've worked on experience 500% performance increases
when run in release. Admittedly some of this is undoubtedly due to
configuration dependent execution.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Jul 26 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris Becker | last post by:
The following code works. My problem is that I don't want to have to hardcode the string that I set resourceName to in the code. Is there a way for me to determine the namespace of the assembly...
2
by: Stu | last post by:
Hi, I want to write a page to track changes on a site. How do I get the build number of the site's dll from a web page? Thanks in advance. Stu
4
by: Henry Padilla | last post by:
I found the following code snippet in the help but it doesn't seem to compile. Dim debugger As EnvDTE.Debugger Dim IsDebugging As Boolean debugger = DTE.Debugger If (debugger Is Nothing)...
6
by: Brad | last post by:
My company is setting up a deployment process for implementing .NET Windows applications. One of the standards we want the process to enforce is verifying that the assembly is built in release...
4
by: ABC | last post by:
I want to check the form's controls have or not the specific properties or events. How to determine or gather the properties list under the run-time environment?
3
by: nautonnier | last post by:
This may have been covered before but I didn't find anything after doing a google search. Does VS.NET 2005 have a way to put build or version numbers within aspx pages? I'm envisioning an...
1
by: Boot2TheHead | last post by:
http://msdn2.microsoft.com/en-us/library/system.reflection.assembly.reflectiononlyloadfrom.aspx When I open an assembly using Assembly.ReflectionOnlyLoadFrom it loads fine, but when I try to...
12
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
I am writing a web app to be widely distributed where I do not know the installed .NET Framework version. I want to take advantage of some .NET 3.0 classes if they are installed, but gracefully...
1
by: SetonSoftware | last post by:
I'm developing a VB.NET 2005 WinForms application that will run on a tablet PC. I want to build a screen resizer method that will position the forms and controls properly depending on whether the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.