如何把编译日期存到程序中
date
Jan 21, 2022
slug
10002
status
Published
tags
C#
summary
type
Post
把这个命令(选一个,第二个是UTC时间)加到Pre-build event commend line(在项目的Properties中)里面,需要先创建好\Resources\BuildDate.txt目录和文件
echo %date% %time% > "$(ProjectDir)\Resources\BuildDate.txt"
powershell -Command "((Get-Date).ToUniversalTime()).ToString(\"s\")
然后在Resources里面添加这个文件,记得保存。
使用方法:
string strCompTime = Properties.Resources.BuildDate;