From 9c65b843453af54dde516ad44a4a53bbcab44bf8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 10 Apr 2020 21:39:50 +1000 Subject: [PATCH] Fix error occurred when publishing self contained .Net Core Wox Error occurs during nuget pack, complaining about some of the core dlls have incorrect timestamp --- Scripts/post_build.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Scripts/post_build.ps1 b/Scripts/post_build.ps1 index f99ff8623..7435059cd 100644 --- a/Scripts/post_build.ps1 +++ b/Scripts/post_build.ps1 @@ -115,13 +115,26 @@ function Pack-Squirrel-Installer ($path, $version, $output) { Write-Host "End pack squirrel installer" } +function IsDotNetCoreAppSelfContainedPublishEvent{ + return Test-Path $solution\Output\Release\coreclr.dll +} + +function FixPublishLastWriteDateTimeError ($solutionPath) { + #Fix error from publishing self contained app, when nuget tries to pack core dll references throws the error 'The DateTimeOffset specified cannot be converted into a Zip file timestamp' + gci -path "$solutionPath\Output\Release" -rec -file *.dll | Where-Object {$_.LastWriteTime -lt (Get-Date).AddYears(-20)} | % { try { $_.LastWriteTime = '01/01/2000 00:00:00' } catch {} } +} + function Main { $p = Build-Path $v = Build-Version Copy-Resources $p $config if ($config -eq "Release"){ - + + if(IsDotNetCoreAppSelfContainedPublishEvent) { + FixPublishLastWriteDateTimeError $p + } + Delete-Unused $p $config $o = "$p\Output\Packages" Validate-Directory $o