我应该版本的ASP.NET Web Site项目怎么样?

问题描述:

我有一个ASP.NET网站项目,我想显示版本号和发布日期,但我不知道如何最好地确定这些。例如,下面的code只是输出 0.0.0.0

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

我应该以某种方式在编译时间确定程序集版本和存储呢?我使用CruiseControl.Net用的MSBuild。

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

使用好执行的程序集时并不需要一个很好的选择,因为执行的程序集将是你的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.

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