473,480 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3364
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
3150
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
1256
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
6190
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
22458
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
3758
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
589
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
1730
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
2800
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
3224
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
7039
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
6904
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
7080
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...
1
6735
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...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.