473,407 Members | 2,676 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,407 software developers and data experts.

FileVersionInfo.IsDebug

I am trying to use the IsDebug property of the
FileVersionInfo class at runtime to determine if the
current application is a debug version. I know the
current configuration that is being compiled is the Debug
configuration yet the value of the property is false. I
can find no documentation that indicates what sets the
property and how the property is related to the compile
time configuration. More documentation in this area
would be appreciated. I also found that there is an
AssemblyConfigurationAttribute but this appears to be a
programmer-defined string that is not related to what the
compiler is doing. Similarly, there is a IsPreRelease
property for FileVersionInfo. How does that value get
set? The documentation in this area is pretty poor.
What really controls these properties?
Jul 21 '05 #1
3 3362
Loyd,
I am trying to use the IsDebug property of the
FileVersionInfo class at runtime to determine if the
current application is a debug version. I know the
current configuration that is being compiled is the Debug
configuration yet the value of the property is false. I
can find no documentation that indicates what sets the
property and how the property is related to the compile
time configuration.


It's up to the compiler to set these flags in the executable's version
resource, but IIRC the C# and VB.NET compilers don't do so as expected
(i.e. IsDebug always returns false).

There are other ways you can do what you want though. The easiest way
would be to use the DEBUG symbol that's usually defined in Debug
builds. So you can do

bool isDebug = false;
#if DEBUG
isDebug = true;
#endif

Another way is to use Reflection to look for the DebuggableAttribute
on the assembly.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Jul 21 '05 #2
Mattias,

I saw your response to a similar question you answered on
Google. Thanks for responding. However, I am looking
for a more general answer. The FileVersionInfo class
contains a number of properties: IsPatched, IsPreRelease,
IsPrivateBuild, IsSpecialBuild..., that contain no
information about how they get defined. However, after
much searching (and luck), I did find at MSDN

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/wceui40/html/cerefversionstatement.asp

documentation that defines the VERSIONINFO resource-
definition statement, which curiously, contains a
fileflags value that defines a set of bits with names
corresponding to the properties mentioned above. (The
documentation happens to be under Windows CE -
interesting.) My bet is that is where the
FileVersionInfo properties get defined from. I haven't
had a chance to verify that yet. First, I need to figure
out how to define resource-definition statements in
the .NET development environment (I think the good
old .rc file is no longer used).
-----Original Message-----
Loyd,
I am trying to use the IsDebug property of the
FileVersionInfo class at runtime to determine if the
current application is a debug version. I know the
current configuration that is being compiled is the Debug configuration yet the value of the property is false. I can find no documentation that indicates what sets the
property and how the property is related to the compile
time configuration.
It's up to the compiler to set these flags in the

executable's versionresource, but IIRC the C# and VB.NET compilers don't do so as expected(i.e. IsDebug always returns false).

There are other ways you can do what you want though. The easiest waywould be to use the DEBUG symbol that's usually defined in Debugbuilds. So you can do

bool isDebug = false;
#if DEBUG
isDebug = true;
#endif

Another way is to use Reflection to look for the DebuggableAttributeon the assembly.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
.

Jul 21 '05 #3
Loyd,
(The
documentation happens to be under Windows CE -
interesting.)
The desktop OS version of the docs are at

http://msdn.microsoft.com/library/en...o_resource.asp

My bet is that is where the
FileVersionInfo properties get defined from.
That's right.

First, I need to figure
out how to define resource-definition statements in
the .NET development environment (I think the good
old .rc file is no longer used).


The compiler will usually generate it for you. It will pull some of
the information (version, copyright etc.) from your assembly
attributes, but other options are just left in their default state.

But the command line compilers let you embed a custom resource file,
and in it you can put a VERSIONINFO resource if you want to provide
your own. See the CSC /win32res option (or VBC's /win32resource) for
details.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Jul 21 '05 #4

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

Similar topics

1
by: SLE | last post by:
Hi there, I need the setter equivalent for System.Diagnostics.FileVersionInfo.GetVersionInfo(). Has anybody implemented a SetVersionInfo()? Some example code or url would be more than...
0
by: NolanB | last post by:
I'm trying to use this class in a mult-threaded app (C#). I'm running on a hyper-threaded CPU (so it looks like 2 x CPUs to the OS) and there is no difference in timings when i run with 1 thread...
1
by: Jim | last post by:
Hi. I would like to validate the version string that I get from FileVersionInfo. Is there a way via the object model to do this? I am currently doing this: FileVersionInfo fileVersionInfo =...
6
by: Frank T. Clark | last post by:
I am having trouble trying to retrieve the version resources of the executing assembly at runtime. I want to retrieve AssemblyTitle, AssemblyDescription, AssemblyCompany, AssemblyProduct, and...
10
by: Magnus Koch | last post by:
Hi, I'm working on a little deployment app to support .Net file deployments to about 7 different locations on the network. It's somewhat intelligent in that it only deploys changed files, and...
4
by: Loyd Nelson | last post by:
I am trying to use the IsDebug property of the FileVersionInfo class at runtime to determine if the current application is a debug version. I know the current configuration that is being compiled...
1
by: roopeman | last post by:
I wrote one program which can query processes info., it 's work well in my local Computer, but failed and got the below error when i query remote host processes,anybody can help me ? that 's when...
2
by: semedao | last post by:
Hi , I am looking for the simple way to get the FileVersionInfo.GetVersionInfo for outlook add in - for the host com also I want to know how to get it in: Console application and in...
2
by: Martin Zugec | last post by:
Hello, I am trying to detect OLESelfRegister in file version info (to detect if library requires registration), but to my surprise FileVersionInfo ignores this flag :( Dim Info As...
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: 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
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?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.