title: How to display version number and auto increment it in ASP.Net MVC - 5 Application
body: <p>I am working on ASP.Net MVC web application. So, I make changes in localhost and then run it and test it. Post which I check in my code. From the main server TEAMCITY builds the project and changes goes live. I am a beginner so I don't know how all this takes place. Also, my manager wants me to show the version number on the <code>website footer</code>. So, I looked into this link <a href="https://stackoverflow.com/questions/12694267/print-version-number-in-asp-net-mvc-4-app">Add Version Number</a> and made below changes.</p>
  
  <p><strong>cshtml file</strong></p>
  
  <pre><code>     var version = @ViewContext.Controller.GetType().Assembly.GetName().Version;
       &lt;p&gt;Version @version&lt;/p&gt;
  
       //and in AssemblyInfo.cs file I added
  [assembly: AssemblyVersion("10.999.7.9")]
  [assembly: AssemblyFileVersion("10.999.999.999")]
  </code></pre>
  
  <p>Now in my local host all I see is 10.999.7.9</p>
  
  <p>Then I found one link which said I need to use "*" to auto increment the version number. this link <a href="https://stackoverflow.com/questions/356543/can-i-automatically-increment-the-file-build-version-when-using-visual-studio">Increment the Version Number</a></p>
  
  <p>But now my manager tells me to revert all the changes in AssemblyInfo.cs file and keep it to original which was</p>
  
  <pre><code>[assembly: AssemblyVersion("10.999.999.999")]
  
  [assembly: AssemblyFileVersion("10.999.999.999")]
  </code></pre>
  
  <p><strong><em>Final Changes that I am checking IN</em></strong></p>
  
  <pre><code>[assembly: AssemblyVersion("10.999.999.999")] // BY DEFAULT
  [assembly: AssemblyFileVersion("10.999.999.999")]  // BY DEFAULT
  </code></pre>
  
  <p>and leave the change of cshtml file intact</p>
  
  <p><strong>cshtml</strong> </p>
  
  <pre><code> var version = @ViewContext.Controller.GetType().Assembly.GetName().Version;
           &lt;p&gt;Version @version&lt;/p&gt;
  </code></pre>
  
  <p>So is that it? Apparently, team city will overwrite the AssemblyInfo.cs information and will update the version number. I am totally confused here. I mean don't I need to use <code>*</code> to auto-increment the version number. Also, how the team city overwrites the assembly.cs file so that below code will have the right version number. </p>
  
  <pre><code>var version = @ViewContext.Controller.GetType().Assembly.GetName().Version;
  </code></pre>
  
  <p>Am I missing something or my manager has missed some details and he is wrong. And to get the correct version number and auto increment it do I need to make changes in Assembly.cs file too and check in assemblyInfo.cs file too? Please guide me.</p>