[英]How should I version an ASP.NET Web Site project?
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. 我有一个ASP.NET网站项目,我想显示一个版本号和发布日期,但是我不确定如何最好地确定它们。 For example, the following code just outputs
0.0.0.0
例如,以下代码仅输出
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.
我正在使用CruiseBuild.Net和MSBuild。
Well using the executing assembly is not neccessary a good choice as the executing assembly will be your web server. 很好地使用执行程序集并不是一个很好的选择,因为执行程序集将是您的Web服务器。 However, you could get the version off an included dll from a type that is implemented by this dll.
但是,可以从此dll实现的类型中获取包含的dll的版本。
typeof(myClass).Assembly.GetName().Version.ToString()
You need to set the Assembly version to be able to use it the way you describe. 您需要设置Assembly版本,以便能够按照您描述的方式使用它。
Most people use the first 3 digits as manual verisons: 大多数人使用前3位数字作为手动验证字:
Major.Minor.Release.xxxx
And many people use the fourth digit for source control revision number. 许多人将第四位用于源代码管理修订号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.