When I want to pack my library as a NuGet package, I get the below error
The DateTimeOffset specified cannot be converted into a Zip file timestamp
I'm using the below command to pack my project:
dotnet msbuild /t:pack /p:Configuration=Release /p:SourceLinkCreate=true
The problem is; some DLL files have invalid dates for a zip file (like 31/12/1979). You can overcome this issue by updating all the invalid DLL files modification date. Here's the Powershell script that updates all the invalid DLLs.
gci -path "C:\" -rec -file *.dll | Where-Object {$_.LastWriteTime -lt (Get-Date).AddYears(-20)} | % { try { $_.LastWriteTime = '01/01/2020 00:00:00' } catch {} }
It sets all the invalid DLL dates to 01/01/2000
.
Change the path
parameter for your computer.
My GitHub repositories are on my C
drive so I'm running this -path C:\
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With