473,372 Members | 1,155 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,372 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 2011
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.