-1

I develop with VS2017 with c#.

Is there a way tgat each time I compile my project ,the version of my exe will Increase ?

Voiilp2
  • 1
  • 1
  • In theory, if you use asterisks in your assembly version numbers, VS is supposed to increment them when you build. In practice, I've never got this to work since VS6 (where it worked fine), so my feeling is no, you can't do it (without some clever post-build process) – Avrohom Yisroel Oct 06 '18 at 22:20

1 Answers1

0

This questions has already been asked/answered here and here; both of those answers refer to the functionality built-in to Visual Studio. However, it has a drawback that the versions generated are based on the time of the build, which is non-deterministic. In other words, the same version of the sources will produce a different version every time you build.

If you want a more deterministic version and you're using Git for source control, there are a few NuGet packages that can generate version information based on your commit history. That is, it increments each time you commit; but a build based on a given commit should always produce the same version. The one I've used is Nerdbank.GitVersioning. It's super easy to use - just install the NuGet package, delete the existing AssemblyFileVersion and AssemblyVersion attributes, and you're probably good to go (unless you've customized your build in some way; but then you'd know best).

Jimmy
  • 23,789
  • 5
  • 77
  • 88
  • If there something like this for SVN? – Voiilp2 Oct 10 '18 at 03:12
  • @Voiilp2 I don't know if there's a plug & play package like with Git, but it looks like it should be possible. I found a post [here](http://www.diogonunes.com/blog/embed-svns-revision-into-assemblyinfos-version-number/) and [here](https://stackoverflow.com/questions/17713513/linking-tortoise-svn-revision-number-to-assembly-version). It'll probably take some extra work on your end but should be doable. – Jimmy Oct 11 '18 at 03:50