开发者

How should I version an ASP.NET Web Site project?

开发者 https://www.devze.com 2022-12-21 09:54 出处:网络
I\'ve got an ASP.NET Web Site project and I\'d like to display a version number and publish date, but I\'m not sure how best to determine these.For example, the following code just outputs 0.0.0.0

I've got an ASP.NET Web Site project and I'd like to display a version number and publish date, but I'm not sure how best to determine these. For example, the following code just outputs 0.0.0.0

LabelVersion.Text = Assembl开发者_StackOverflow社区y.GetExecutingAssembly().GetName().Version.ToString();

Should I determine the assembly version somehow during build time and store this? I'm using CruiseControl.Net with MSBuild.


Well using the executing assembly is not neccessary a good choice as the executing assembly will be your web server. However, you could get the version off an included dll from a type that is implemented by this dll.

typeof(myClass).Assembly.GetName().Version.ToString()


You need to set the Assembly version to be able to use it the way you describe.

Most people use the first 3 digits as manual verisons:

Major.Minor.Release.xxxx

And many people use the fourth digit for source control revision number.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号