我应该如何对 ASP.NET 网站项目进行版本控制?

发布于 2024-08-23 06:47:44 字数 265 浏览 10 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愿与i 2024-08-30 06:47:44

使用执行程序集不一定是一个好的选择,因为执行程序集将是您的 Web 服务器。但是,您可以从该 dll 实现的类型中获取包含的 dll 的版本。

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

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()
哑剧 2024-08-30 06:47:44

您需要设置程序集版本才能按照您描述的方式使用它。

大多数人使用前 3 位数字作为手动版本:

Major.Minor.Release.xxxx

许多人使用第四位数字作为源代码控制修订号。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文