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.
.