1

today I tried a lot of time to add the AssemblyVersion AND AssemblyFileVersion to my Visual Basic exe file.

In our environment, the AssemblyVersion should always be the same, and if somebody makes some changes he will increase the AssemblyFileVersion manual.

The Problem is the following:

When I add in the project settings the assembly-version, the details of my .exe show on both (ProductFileVersion and ProductVersion) the same version number although the AssemblyInfo.vb file has the correct entries for AssemblyVersion and AssemblyFileVersion.

When I add in the project settings additionally a file version number, then both attributes within the exe file have the AssemblyFileVersion number.

I remember, that I read about this stuff already in the past and I think to remember, that the second attribute (FileVersion) is forced, but I dont remeber exactly.

Is there somebody out there, who could help me please in this matter?

So how I have to proceed to see both version-numbers in my .exe details after compiling?

Thanks for your help and best regards!

Mark Mullen
  • 15
  • 1
  • 6

1 Answers1

0

If memory serves, both VB.NET and C# build version numbers using the same pattern and using wildcards. If you do not provide a wildcard in your assembly/file version number, the version number will be fixed (that is, you'll have to manually update it).

Consequently, all you should have to do is set a full version number in your AssemblyInfo.vb file to prevent it from changing:

' This number will not increment.
<Assembly: AssemblyVersion("1.0.0.9")>

On the other hand, if you want a version number to increment with each build, add a wildcard to the last segment:

' This number will auto increment
<Assembly: AssemblyVersion("1.0.0.*")>

For more information, see Managing Versions of an Application on MSDN.

EDIT

You are probably looking for the AssemblyInformationalAttribute, which sets the Product Version. This is a string, not an integral value, so you can set it to something like "1.0.9 RC1". But you can set it to a fixed version number if you like. See this excellent SO question for more information.

Community
  • 1
  • 1
Mike Hofer
  • 16,477
  • 11
  • 74
  • 110
  • Hi Mike, I have already full version number in my AssemblyInfo.vb and also a full version number for AssemblyFileVersion. Here is my test entry: but after comiling, both .exe attributes have 1.1.1.1. I dont want a automatically increment. We do it manually by edit via the project settings. – Mark Mullen Jun 29 '15 at 20:16
  • @MarkMullen So do you have them set to different versions, but they are displayed only as the FileVersionNumber in the Project Properties window? If that is the case, I would double-check the spelling of the attributes in the AssemblyInfo window. – Mike Hofer Jun 29 '15 at 20:23
  • @MarkMullen: Heh, we crossed comments. :) That is odd. They look syntactically correct. What version of Visual Studio are you using? – Mike Hofer Jun 29 '15 at 20:26
  • @MarkMullen Also, did you move your assemblyinfo.vb file to another folder? – Mike Hofer Jun 29 '15 at 20:28
  • The AssemblyVersion and the AssemblyFileVersion are correct displayd under projectsettings->assemblyinformations. When I make changes in that gui-dialog e.g. for AssemblyVersion and/or AssemblyFileVersion it is also everything correct. Even the numbers in the AssemblyInfo.vb file are changing correctly after rebuild. But when I make a right click on my exe and go to details, then the product version AND the ProductFileVersion show the same number, only the product file version. Product file version is gone. I checked already the spelling and everything is alright. – Mark Mullen Jun 29 '15 at 20:31
  • @MarkMullen I use VS2013 community edition, but it appears also in the professional edition – Mark Mullen Jun 29 '15 at 20:32
  • @MarkMullen AHA! You want the AssemblyInformationalVersion attribute! – Mike Hofer Jun 29 '15 at 20:34
  • @MarkMullen AHA! :) Your hint about AssemblyInformationalVersion helped, now I have different numbers in the .exe details. But can I change the AssemblyInformationVersion within the project settings in a gui-dialog? – Mark Mullen Jun 29 '15 at 20:40
  • @MarkMullen No, unfortunately, that one has to be hand-edited through the AssemblyInfo.vb file. I can only get you so far, my friend. I can't work miracles! :D Super pleased it worked for you, tho! – Mike Hofer Jun 29 '15 at 20:54
  • Thank you very much. Helped me out. So I have to edit this manually...doesnt matter for me – Mark Mullen Jun 29 '15 at 20:59