Skip to content

Commit 9c65b84

Browse files
committed
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
1 parent 7ba6dbf commit 9c65b84

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Scripts/post_build.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,26 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
115115
Write-Host "End pack squirrel installer"
116116
}
117117

118+
function IsDotNetCoreAppSelfContainedPublishEvent{
119+
return Test-Path $solution\Output\Release\coreclr.dll
120+
}
121+
122+
function FixPublishLastWriteDateTimeError ($solutionPath) {
123+
#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'
124+
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 {} }
125+
}
126+
118127
function Main {
119128
$p = Build-Path
120129
$v = Build-Version
121130
Copy-Resources $p $config
122131

123132
if ($config -eq "Release"){
124-
133+
134+
if(IsDotNetCoreAppSelfContainedPublishEvent) {
135+
FixPublishLastWriteDateTimeError $p
136+
}
137+
125138
Delete-Unused $p $config
126139
$o = "$p\Output\Packages"
127140
Validate-Directory $o

0 commit comments

Comments
 (0)