0
public class AV
{
System.Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
public string currentVersion()
{
string VersionLabel = "Version: " + version.Major + "." + version.Minor + " " + BuildDate().ToShortDateString();
return VersionLabel;
}
public DateTime BuildDate()
{
try
{
DateTime date = Convert.ToDateTime("8/1/2017");
System.Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
date = date.AddDays(version.Build);
date = date.AddSeconds(version.Revision * 2);
if (TimeZone.IsDaylightSavingTime(System.DateTime.Now, TimeZone.CurrentTimeZone.GetDaylightChanges(System.DateTime.Now.Year)))
{
date = date.AddHours(1);
}
return date;
}
catch (Exception ex)
{
return DateTime.Now;
}
}
}
をテストするとき、私はHTMLでこのモデルクラスを使用し、今そのはちょうど私が公開した回数だけで日付を表示し、現在のバージョンバージョン私のコードの生産にして公開または
を呼んでいます。それはビルドの日付を取得していません。ビジュアルスタジオで何かを有効にする必要があるか、何かを追加する必要がありますか?
ありがとうございました。