如何显示您的 ASP.NET 应用程序版本?
设置场景:
我的 ASP.NET Web 应用程序带有一个版本号,该版本号在每次发布时都会递增。我们每周都会在内部向我们的测试团队发布,并在大约四个星期后向我们的客户发布。
问题:
我想在我们的应用程序中包含版本号。您使用了哪些方法让您的网络应用程序带有版本号?元标签?只是将其添加到页脚吗?
Setting the scene:
My asp.net web application carries a version number which is incremented during every release. We're releasing every week internally for our test team and after four weeks or so to our client.
The question:
I want to include the version number on our application. What methods have you used so that your web app carries the version number? meta tag? simply added it to the footer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您经常与客户联系(为了错误修复或更改),您应该将版本号保留在易于找到的位置(例如页脚)。您会发现自己询问客户他们正在运行什么版本,如果他们找不到它,这对客户和支持人员来说都是令人沮丧的。
确保您的页脚是用户控件,或者版本存储在数据库表或资源文件中,以便您更新一次,而不是更新每个页面。我的建议是用户控件,如果您想跟踪版本控制,请将版本号存储在数据库中并将其读入您的用户控件。
您可以采用 MS 路线,对给定的菜单执行帮助->关于,并在 js 弹出窗口或另一个页面上显示版本号。
如果由于某种原因您不喜欢页脚甚至帮助菜单弹出窗口上的版本号,并且您不定期与客户端打交道,您可以将其作为元数据或 HTML 源代码中。
If you are in contact with the client a lot (for bug fixes or changes) you should keep the version number in a place that is easy to find (such as the footer). You will find yourself asking the client what version they are running, if they cannot find it it is frustrating for both the client and the support staff.
Make sure your footer is a user control or that the version is stored in either a database table or a resource file so that you update once rather then going through each page updating. My recommendation is a user control and if you want to track versioning store the version numbers in a database and read it into your user control.
You can take the MS route of doing a help->about given a menu and displaying the version number in say a js popup or on another page.
If for some reason you do not like the version number on a footer or even a help menu popup and you do not deal with the client regularly you can put it as meta data or in the source code of your HTML.
我见过很多 Web 应用程序(和网站)在生成的 HTML 中添加版本号作为注释。 BBC 就是其中之一 - 查看源代码,您将在标题中看到
。 (Barlesque 是 BBC 的布局系统。)
I've seen a lot web applications (and websites) I've seen that add the version number as a comment within the generated HTML. The BBC is one of them - view the source and you'll see
<!-- Barlesque v34.8 -->
in the header. (Barlesque is the BBC's layout system.)我们有一些信息页面,其中显示版本号(SaaS 应用程序)。
但说实话,版本号与网络软件无关。这就是迁移到网络的目的 - 让用户最终忘记那些版本、更新、服务包等。否则,任何一方都无法真正理解不断更新的网络应用程序(永久测试版)的想法。
We have some information page where we display the version number (SaaS application).
But seriously, with web software version numbers are irrelevant. It is the point of migrating to the web - so that the users finally forget about those versions, updates, service packs etc. Otherwise the idea of a constantly updated web application (perpetual beta) is not really grasped by either party.
在某些项目中,我们将版本号添加到页脚。我们显示了程序集(我们的任何程序集)版本号。
使用这种方法,只要增加程序集版本,我们就不必关心页脚中的文本。
程序集版本是通过反射提取的。
In some Projects we added the Version number to the footer. We displayed the Assembly (any of our Assemblies) Version number.
With that method we did not have to care about the text in the footer as long we incremented the Assembly Version.
Assembly Version was extracted with Reflection.
查看此处发布的代码。它将收集并显示 .NET Framework 版本信息。任何时候您需要当前程序集的版本信息,都可以使用
类似地,要获取特定程序集的版本信息,您可以直接反映在程序集上,或者简单地使用程序集中的类,
其中 ClassKnownToBeInTheTargetAssembly 是在您想要其版本信息的程序集。
顺便说一句,这些注释假设程序集已签名。
Check out the code posted here. It will gather and display the .NET Framework version info. Anytime you need the version information of the current assembly, you can use
Similarly, to get the version info for a particular assembly, you can either reflect directly on the assembly, or simply use a class in the assembly
where ClassKnownToBeInTheTargetAssembly is a class declared in the assembly you want the version info for.
BTW, these comments assume that the assemblies are signed.