我应该如何对 ASP.NET 网站项目进行版本控制?
我有一个 ASP.NET 网站项目,我想显示版本号和发布日期,但我不确定如何最好地确定这些。例如,以下代码仅输出 0.0.0.0
LabelVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
我应该在构建期间以某种方式确定程序集版本并存储它吗?我正在将 CruiseControl.Net 与 MSBuild 结合使用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用执行程序集不一定是一个好的选择,因为执行程序集将是您的 Web 服务器。但是,您可以从该 dll 实现的类型中获取包含的 dll 的版本。
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.
您需要设置程序集版本才能按照您描述的方式使用它。
大多数人使用前 3 位数字作为手动版本:
许多人使用第四位数字作为源代码控制修订号。
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:
And many people use the fourth digit for source control revision number.