0

I am trying to use the build Publish Version from Properties in my winform application.

But the version that always ends up in the application is 0.0.0.123. I found that this is the last version I had for this application back in VS2010. All new VS2012 are always 1.0.0.0

Looking at this post: C#: how to set version number of assembly I found that the AssemblyInfo.cs file hods the version information and I can change it there but why is the version from the properties tab not used?

Community
  • 1
  • 1
Michael Elkin
  • 221
  • 2
  • 4
  • 15
  • You can find the Publish version in the ApplicationProperties -- Publish tab. – Chase Ernst Aug 07 '14 at 15:15
  • I found the answer here: http://stackoverflow.com/questions/3975601/c-how-to-set-version-number-of-assembly?rq=1 which works, but now I have the question of why VS2012 does not update the version itself? – Michael Elkin Aug 07 '14 at 15:25

2 Answers2

1

The version information is under: Application Properties-Application -Assembly Information button.

This is the basic place to change the version and is not linked to the Publish version and does not Auto-Increment. I no longer have older version to check if these options were linked before. At least I can change version without resorting to changing text.

Michael Elkin
  • 221
  • 2
  • 4
  • 15
0

In order to find the Publish Version, go to

Application Properties
   -Publish

At the bottom of the screen is the publish version. You can manually change the publish version to whatever you want. Or you can have it automatically increment the revision number.

In order for the revision number to automatically increment you need to change your application from Debug to Release up at the top of the screen near the green start button. Or you can press the publish now button on that screen

This question here may also point you in the right direction.

If you area not needing the version to auto-increment try this here:

using System;
using System.Reflection;

[assembly:AssemblyVersion("1.1.0.0")] //Put the desired version number here.

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {

        this.Text = typeof(Form1).Assembly.GetName().Version.ToString();
    }
}

this will display the version number inside the text of the form header.

Community
  • 1
  • 1
Chase Ernst
  • 1,147
  • 1
  • 21
  • 53
  • I am trying to use Publish field but it is not working. I have VS2012 Ultimate Update 4 on 2 machines and neither one works. – Michael Elkin Aug 07 '14 at 15:49
  • I can change the version number manually though the AssemblyInfo.cs, but that is not a good solution. I am looking though the post you mentioned. – Michael Elkin Aug 07 '14 at 15:55
  • If it might help, I don't need an auto increment of my version number since I change it manually I just want it take effect. – Michael Elkin Aug 07 '14 at 15:57
  • When you are updating it in the properties it isn't taking effect? – Chase Ernst Aug 07 '14 at 16:14
  • http://stackoverflow.com/questions/18300163/get-application-version-always-return-1-0-0-0?rq=1 talks about the same issue, but mentioned that when published it displayed the correct version. I don't publish (never worked) but copy the exe and other files from the appropriate Release or Debug folder. – Michael Elkin Aug 07 '14 at 16:19
  • Setting the AssemblyVersion in code like you said did not work. It did not cause and error, and did not generate an output?? I would like to set the version outside of the code, but that would be fine as long I only have one place to edit every time. – Michael Elkin Aug 07 '14 at 17:21
  • Try opening the AssemblyInfo.cs file. Locate and delete `[assembly: AssemblyVersion("x.x.x.x")]` and then it should work. Are you referencing `System` and `System.Reflection`? This should allow you to only change it in one place. – Chase Ernst Aug 07 '14 at 17:25
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58903/discussion-between-michael-elkin-and-chase-ernst). – Michael Elkin Aug 07 '14 at 18:05