获得一个.NET程序集的日期 [英] Getting the date of a .NET assembly
问题描述
我如何可以检索从目前的.NET程序集的创建日期?
How can I retrieve the Created date from the current .NET assembly?
我想添加一些真的简单的功能,其中我的应用程序停止一周主组件的构建日期后工作。我已经写了code,一个给定的日期后杀死我的应用程序。我只需要以编程方式检索从组件的创建日期。
I'd like to add some realy simple functionality where my app stops working one week after the build date of the main assembly. I already wrote the code that kills my app after a given date. I just need to programmatically retrieve the creation date from the assembly.
推荐答案
我不认为大会本身包含它的创建日期。我怀疑最接近你可以得到的是组件的创建日期文件本身:
I don't think the assembly itself contains it's creation date. I suspect the closest you can get is the creation date of the assembly file itself:
File.GetCreationTime(Assembly.GetExecutingAssembly().Location)
应该做的伎俩。
should do the trick.
编辑:
我觉得杰夫·阿特伍德的解决方案,在这个线程写了以手榴弹,可能是更好的方式走了。
I think Jeff Atwood's solution, written up by "grenade" in this thread, is probably the better way to go now.
这篇关于获得一个.NET程序集的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!