5

how do i make the [assembly: AssemblyVersion("1.0.*")] in the assemblyInfo.cs for aboutbox to be similar with the publish version at the project property?

currently it seem that i have to enter twice.. i refered to this link example, and i don get the result as expected..

Community
  • 1
  • 1
VeecoTech
  • 2,073
  • 8
  • 37
  • 49
  • http://stackoverflow.com/questions/721609/clickonce-same-publish-version-but-assembly-version-different-update-not-happeni - I think this may be a similar issue – AMadmanTriumphs Feb 27 '11 at 07:39
  • I really don't understand what you're trying to do. Visual Studio doesn't support auto-incrementing the `AssemblyFileVersion` property. That only works with `AssemblyVersion`. Try [this add-in](http://autobuildversion.codeplex.com/) instead, which will automatically increment both version numbers each time you compile, and is fully customizable. – Cody Gray - on strike Feb 27 '11 at 09:18

3 Answers3

1

Use ApplicationDeployment.CurrentDeployment.CurrentVersion to get the Publish version

dbu
  • 29
  • 4
1

Just comment out the line:

[assembly: AssemblyFileVersion("1.0.0.0")]

in AssemblyInfo.cs file. So, two last lines of that file will be:

[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

Rebuild the project and your Assembly version and the .dll file version will be identical.

myroslav
  • 1,670
  • 1
  • 19
  • 40
  • This is a great tip but it doesn't sync Assembly with Publish. I like that it gets us down from 3 versions to 2 but now we need to sync the remaining 2 possible versions. I understand that the fields could remain the same between publish so it often makes sense to have 2 version numbers. – HackSlash Jun 22 '18 at 18:32
0

The answer as it appeared in 2011

You can modify the AssemblyInfo.cs file. This exists per project. In recent Visual Studio versions it may be nested under "properties" visual studio folder under the project.

Go to your project, expand that, go to "Properties", expand that, open the "AssemblyInfo.cs" file.

Most likely you'll see it end with:

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

So, you can change the attributes.

Update (February 2011)

Also check:

Meligy
  • 35,654
  • 11
  • 85
  • 109
  • thanks for the reply. ya i do not want to write my version 2 times. when i want to publish, i will modify the publish version at the project property and also modify the AssemblyVersion at the assemblyInfo.cs which u have just specify. I felt it redundant. Could it be simplify into just one step? – VeecoTech Feb 27 '11 at 09:10
  • I see your point now. See the update to my answer, not sure if it helps. – Meligy Feb 27 '11 at 09:34
  • i have tried both of the links u provided, but i still not able to get the publish version i specified at the project property. It is showing some long version of build version which i did not specify. – VeecoTech Feb 27 '11 at 10:04