Cannot Set File Version in .NET 2.0

S

stephenculver

Previously, when we built the exe for a PDA application in 2003, the
AssemblyVersion set in the AssemblyInfo would be caried over to the
FileVersion for the exe.

I have some code used to update the exe (using a cab file) if a new
version is found.
I am doing this from the PC.
To do this previously, I copied the exe from the PDA to the PC
(temporarily) and looked at its file information:
System.Diagnostics.FileVersionInfo fi =
System.Diagnostics.FileVersionInfo.GetVersionInfo(path);
Version version = new Version(fi.FileVersion);

This was a very simple process just to get the version that is
installed.

With new apps developed in Visual Studio 2005, the file versions are
blank (empty string).

There seems to be no settings in the Assembly Info for setting them,
and if you go to the new Properties page for the project you can see
the File Version area, BUT it is grayed out.

Does anyone have any alternatives to doing this. I have seen lots of
code to get the version while it is running, but this is for a file
that is not running and I need to get its version from a PC based app.

Thanks
Stephen
 
P

Peter Foot [MVP]

Have you tried the AssemblyInformationalVersion attribute I believe this is
the one used in the native file header e.g.

[assembly: AssemblyVersion("1.0.51117.0")]

[assembly: AssemblyInformationalVersion("1.0.51117.0")]



Peter
 
S

stephenculver

Yes I have, and this too doesn't seem to affect anything. I read a post
that said this corresponds to the ProductVersion of FileInfo but it did
not when I tested it.

I even tried to set the AssemblyDescription and AssemblyProduct tags to
see if they exposed anything in the FileInfo, but I couldn't even get
those.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top