Visual Studio 2013 version number for exe file? - visual-studio-2013

Hi i want to ask that when we build our project in VS we know that exe get automatically created but my client wants that exe with version number and every time i click on build and the new exe will create with the newer version number.So is there any possibility for this version writing ,i think "no" as i have never seen any exe with version number ?So please clear my confusion .However ,i know that when we publish our software it creates "Publish version " for us but my client do not want publish he wants just exe !!

In the AssemblyInfo.cs file, change :
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
by
[assembly: AssemblyVersion("1.0.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
(that will change last number with a number in relation with when you build (time only))
or
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
(that will change 2 lasts numbers with a number in relation with when you build (date.time))

Related

Custom File Version/ Product Version of exe by building an application

As the title suggests I need to assign an application a custom file and/or product version by building a project from Visual Studio.
I know you can assign a build number from an application publish but I am not publishing these applications, I am simply building "release" files.
Is there a way within Visual Studio to specify these file versions before I build the application?
Thanks in advance!
Is there a way within Visual Studio to specify these file versions before I build the application?
Yes, you can specify File/Product version by AssemblyInfo.cs before you build the application.
First, the File version looks for the attribute AssemblyFileVersion in the AssemblyInfo.cs file. So you can specify the File version by setting the value AssemblyFileVersion. I change the AssemblyFileVersion value from 1.0.0.0 to 2.0.0.0:
[assembly: AssemblyFileVersion("2.0.0.0")]
Second, ProductVersion first looks to see if the assembly containing the main
executable has the AssemblyInformationalVersion attribute on it. If this
attribute exists, it is used for Product Version.
If this attribute does not exist, both properties use the AssemblyFileVersion instead.
So, in your project, open the AssemblyInfo.cs file. In this file, I added a
line like this:
[assembly: AssemblyInformationalVersion("4.0.0.0")]
Then after build is complete. The file version is 2.0.0.0 and the product version is 4.0.0.0.

How do I fix line break in AssemblyInfo.cs when I create project?

In Visual Studio 2015, every time I create a new project, I have to fix AssemblyInfo.cs because it generates these two lines:
[assembly: AssemblyCompany("
")]
and
[assembly: AssemblyCopyright("Copyright ©
2016")]
It did not always do this. I'm guessing there is a setting somewhere or a template I can fix.
How do I stop this from happening?
I've had a look at the project templates on my machine which are located at
C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\ProjectTemplates
The AssemblyCompany and AssemblyCopyright lines show
[assembly: AssemblyCompany("$registeredorganization$")]
[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")]
I suspect that you somehow have a newline character in your registeredorganization.
Have a look at this superuser.com question for details of where to find/change it How can I change the “licensed to” in visual studio?. Also note the comment under that question as it may be reading from the Windows registered organization.
You might also want to have a look at the project templates on your machine (see quoted location above), though it seems less likely that the default template has been changed.

Turn Off Auto Increment on AssemblyInfo.cs?

We have a build server that is managing version numbers. When we debug we create a local build that also tries to manage the version numbers. The result is perpetual version control (SVN) conflicts in AssemblyInfo.cs that need to be resolved.
Note: we are using [assembly: AssemblyVersion("w.x.y.z")], and not the wildcard mentioned by #estebane below.
How does one turn off the auto increment feature of Visual Studio 2010?
Try this:
open project properties in VS
click the Application tab
click "Assembly Information" button
set both Assembly and File version
clean solution and rebuild
clean and rebuild projects that use your dll as reference
If this doesn't work your problem is elsewhere.
You can check the effect on these settings by finding the dll in windows explorer, right-click, select "Properties", click on "Details" tab and check the File version and Product version fields. If these behave as expected try tracking down where is your out-of-date copy that you're actually loading.
In your AssemblyInfo file you can set the version and avoid auto increment using
[assembly: AssemblyVersion("1.0.0.0")]
If auto increment is active it looks like
[assembly: AssemblyVersion("1.0.*")]
Try with the following to set a fixed Assembly version of 1.0.0.0 and a fixed File Version of 1.0.*.
[assembly: AssemblyVersion("1.0")]
[assembly: AssemblyFileVersion("1.0.*")]
Hope this will stop incrementing your assembly version.
Do you have any pre or post build steps that are changing it? Maybe look in the build's output window to see if that gives any indication of what process might be changing it.
If you originally have [assembly: AssemblyVersion("1.0.0.0")] in your AssemblyInfo.cs file and it changes post build, something other than VS.NET is modifying that file.
Seems like you have another non-default software/plugin/extension updating your version number. Because Visual Studio won't do it when you don't use wildcards.
Check your Visual Studio AddIns list and Extensions list.

Updating AssemblyInfo.cs for multiple projects in a solution for adding a version numbers

Is there a tool to update the assembly version in AssemblyInfo.cs for all projects in a solution?
I have a solution which has about 30+ projects and I don't see myself checking out AssemblyInfo.cs for each of these projects from source control(TFS) and doing this manually.
Basically I'm looking for something that will remove
[assembly: AssemblyFileVersion("1.0.0.0")] and change
[assembly: AssemblyVersion("1.0.0.0")] to [assembly: AssemblyVersion("1.0.*")]
I could set the source control plugin settings to automatically check out instead of prompting but still need to have AssemblyInfo update automatically somehow.
I always do that during the Build. See http://www.ewaldhofman.nl/post/2010/05/13/Customize-Team-Build-2010-e28093-Part-5-Increase-AssemblyVersion.aspx for detailed steps

How to Setting up visual studio 2010 to set as auto-increment version of project on each build

How to setting-up visual studio 2010 to set as auto-increment version of project on each build?
Does this feature exist on vs2010?
Change the AssemblyInfo.cs-File:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
to
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
As someone else mentions the 1.0.* is always replaced with 1.0.{date}.{time] so it should be always be increment (you would have thought)
In VS2010 changing the AssemblyVersion to [assembly: AssemblyVersion("1.0.*")] works, be warned that you must close the solution/project, re-open it then re-build it (not build) to refresh/change the build+revision values.
The date/time appears to be obtained from the time the project is opened thus the close/re-open to refresh the revision/build values, I guess this is useful if you are changing various bits within the project in one go and it won't keep changing the AssemblyVersion possibly breaking other bits.
To return the date from the build value:
DateAdd(DateInterval.Day, build, DateValue("01/01/2000"))
' build is the number of days from 1/1/2000
To return the time from the revision value:
Date.FromOADate(revision / 1800 / 24)
' depending on your timezone you may have DST/BST issue with resulting time
The AssemblyInfo.cs - file doesnt exist if you're deveolping native software with c/c++ ... hence this answer is useless for a whole lot of developers out there - one could have a look into http://autobuildversion.codeplex.com ... but this extension doesnt seem to work with VS2010 although the website says otherwise - you may be good to go if you're using older versions of VS, though
I just tried the autobuildincrement method and had problems with Visual Studio 2010 however I found a way to make it work. Set "Increment Before Build to false. Then even in Visual Studio 2010 the assempblyinfo.cs file will be updated after each build.
Note the assembly info on your dll won't change on your first build, but it will after that.
DateTime.Parse(#"1/1/2000")
.AddDays(FileVersionInfo.GetVersionInfo(
System.Reflection.Assembly.GetEntryAssembly().Location
).FileBuildPart)
.AddSeconds(FileVersionInfo.GetVersionInfo(
System.Reflection.Assembly.GetEntryAssembly().Location
).FilePrivatePart * 2)

Resources