How can I make the AssemblyInfo version of a C # .NET CF program propagate in the explorer properties window?

It seems that if you are compiling a Visual Studio solution and have version # in the AssemblyInfo.cs file, which should be distributed, say, the Windows Explorer properties dialog. That way, someone can simply right-click on * .exe and click on "properties" to see version #. Is there a special setting in Visual Studio for this to happen?

sample image http://content.screencast.com/users/Pincas/folders/Jing/media/40442efd-6d74-4d8a-8e77-c1e725e6c150/2008-09-24_0849.png

Edit: I should have mentioned that this is, in particular, for the .NET Compact Framework 2.0, which does not support AssemblyFileVersion. Is everyone lost?

+3
source share
7 answers

Note that the AssemblyFileVersion attribute is not available in the .NET Compact Framework !

See this article by Daniel Mooth for a workaround.

+6
source

:

[assembly: AssemblyFileVersion("1.0.114.0")]

, AssemblyVerison, .NET.

+1

"" , . , VS , , . , DSO OleDocument Properties Reader Microsoft.

: http://www.microsoft.com/downloads/details.aspx?FamilyId=9BA6FAC6-520B-4A0A-878A-53EC8300C4C2&displaylang=en

: http://www.developerfusion.co.uk/show/5093/

. , pb Nigel Hawkins , AssemblyFileVersion, :

[assembly: AssemblyFileVersion("1.0.114.0")]
+1

, RevisionNumber - , .

, → AssemblyVersion.

0

FileVersion = YYYY.MM.DD.BUILD(, 2008.9.24.1), ProductVersion major.minor.revision.BUILD. AssemblyInformationalVersion, .

AssemblyVersion = "MAJ.MIN.REV.1" → .NET

AssemblyInformationalVersion = "MAJ.MIN.REV.XXX" → explorer ProductVersion

AssemblyFileVersion = "YYYY.MM.DD.XXX" → FileVersion

0

. AssemblyInfo .NET CF 3.5. "" Windows ( , )

, , , , Reflection Linq "AssemblyInformationalVersion" ( Visual Studio).

AssemblyInfo.cs( , ):

[assembly: AssemblyInformationalVersion("1.0.0.0 Alpha")]

Then you can use this method to pull out the attribute (I placed it inside the static class in the AssemblyInfo.cs file). The method receives an array of all assembly attributes, then selects the first result corresponding to the attribute name (and gives it to the correct type). After that, you can access the InformationalVersion line.

//using System.Reflection;
//using System.Linq;
public static string AssemblyInformationalVersion
{
    get
    {
        AssemblyInformationalVersionAttribute informationalVersion = (AssemblyInformationalVersionAttribute) 
            (AssemblyInformationalVersionAttribute.GetCustomAttributes(Assembly.GetExecutingAssembly())).Where( 
                at => at.GetType().Name == "AssemblyInformationalVersionAttribute").First();

        return informationalVersion.InformationalVersion;
    }
}

To get the normal attribute "AssemblyVersion", I used:

//using System.Reflection;
public static string AssemblyVersion
{
    get
    {
        return Assembly.GetExecutingAssembly().GetName().Version.ToString();
    }
}
0
source

All Articles