简体   繁体   中英

how to show the current build with c# or msbuild?

I created an asp.net mvc4 application and I have setup continuous integration and deployment to windows azure.

Because I have configured it to build after checkin, it would be very useful to print somewhere in the application which build is using.

I guess there should be a way with c# and msbuild api if it exists, which is the current build.

something like: FullStackSampleApplication_20130413.2

Any guidance would be really appreciated.

I found this line:

Update1: I added this to AssemblyInfo.cs

[assembly: AssemblyVersion("1.0.*")]

string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

This line is printing 0.0.0.0

To generate new build number and revision on each build, add to your AssemblyInfo.cs

[assembly: AssemblyVersion("1.0.*")]

The generated numbers will be based on build time. Build number will be the number of days since 2000, and revision number will be the number of seconds since midnight/2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM