sibartlett / Geo

A geospatial library for .NET
https://www.nuget.org/packages/Geo/
GNU Lesser General Public License v3.0
176 stars 39 forks source link

Missing Date Modified on dll causing issues with Nuget #47

Open kinjiru opened 4 years ago

kinjiru commented 4 years ago

When attempting to include Geo.dll in a nuget package the packaging fails with error 'The DateTimeOffset specified cannot be converted into a Zip file timestamp' because Geo.dll's Modified date is empty.

I believe nuget pack calls the CreateEntryFromFile method documented below, which sets the file's date in the nuget package to the file's Modified date: https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.zipfileextensions.createentryfromfile?view=netframework-4.7.2

As a workaround our CI process performs this step to set the Modified date before packaging: gci -path "geo.dll" -rec -file *.dll | Where-Object {$_.LastWriteTime -lt (Get-Date).AddYears(-20)} | % { try { $_.LastWriteTime = '01/01/2020 00:00:00' } catch {} }

Note this was not an issue with Nuget 4.5, but is an issue with Nuget 5.4. From the link above it appears that it would be an issue with Nuget > 4.6 Proposed solution: Update Geo.dll build process to set the file's Modified date (same as Created date?)

image