I am creating an About box for one of my apps that should reflect the version number of the app as specified in the AssemblyVersionAttribute in AssemblyInfo.cpp, preferably without requiring me to have to update the number in two distinct locations in parallel. The Application::ProductVersion propperty looked promising for that purpose, as I interpret the MSDN docs, but it seems to always return "1.0.0.0", regardless of what I set up in AssemblyInfo.cpp. Could there be anything typical that I might be doing wrong and/or any other way to access this information?
In case that matters: I have only tried this with the debug build so far.
BTW: What means "using the default values" for the build and revision numbers as it has been preset by the IDE by setting AssemblyVersionAttribute to "1.0.*"?
I also would like to access what I have set up for AssemblyCopyrightAttribute in AssemblyInfo.cpp, but I haven't seen any (possible) way to do that at all.
TIA
Last edited by Eri523; June 24th, 2011 at 03:28 PM.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
But I'm referring to AssemblyInfo.cpp and don't know the C# equivalent for that. Besides that, I have noticed that there are distinct Application classes for Windows Forms and WCF (in distinct namespaces) that significantly differ in their properties and am afraid of confusion when asking there.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
C# project generated by Application Wizard has AssemblyInfo.cs file. In any case, the answer is somewere in Reflection and accessing current assembly attributes, this must be the same in all .NET languages.
Thanks for pointing me to the Reflection API. I initialy considered this to be a natural choice too, but then I thought using the Application object would be more straightforward.
I still don't know why Application::ProductVersion doesn't give me the desired result, but this does:
I still have not found a way to retrieve the copyright string in the Reflection API, simply because I've not yet looked for it. But even if it isn't there (what I consider to be unlikely) it wouldn't be too much pain: It doesn't change that frequently.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Bookmarks