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

我与影子孤独终老i 提交于 2019-12-24 04:24:10

问题


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 = Assembly.GetExecutingAssembly().GetName().Version.ToString();

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


回答1:


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()



回答2:


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.



来源:https://stackoverflow.com/questions/2314789/how-should-i-version-an-asp-net-web-site-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!