![](/img/trans.png)
[英]Is an assembly signed with a strong name before or after the post-build event?
[英]Post Build event that zip files with timestamp in name
我正在嘗試制作一個構建后事件,zip 發布文件,時間戳作為文件夾名稱的一部分。 我正在創建 zip 文件,如下所示:
if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(ProjectDir)$(OutDir)' -DestinationPath '$(ProjectDir)bin\MyFile.zip' -Force)
現在我有名為“MyFile.zip”的 zip 文件,但我希望它的名稱中有日期,如“04.12.2020.MyFile.zip”。
有誰知道該怎么做?
您可以嘗試使用 MSBuild 屬性函數。
這是修改后的構建步驟:
if $(ConfigurationName) == Debug (powershell Compress-Archive -Path '$(ProjectDir)$(OutDir)' -DestinationPath '$(ProjectDir)bin\MyFile_$([System.DateTime]::Now.Year)-$([System.DateTime]::Now.Month)-$([System.DateTime]::Now.Day).zip' -Force)
您可以將其調整為所需的格式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.