Modify System.IO.Packaging files to ensure they are deterministic. Helpful for testing, build reproducibility, security verification, and ensuring package integrity across different build environments.
Example file formats that leverage System.IO.Packaging
- .nupkg
- Microsoft Office files
See Milestones for release notes.
- For an input package stream
- Duplicate each entry with a consistent compression and consistent order
- Omit
package/services/metadata/core-properties/*.psmdcp
entries - For the relationships entry
_rels/.rels
- Modify the
Id
of eachRelationship
to be deterministic - Remove the
Relationship
for the.psmdcp
entry - Order
Relationship
s byType
- Modify the
- For the relationships entry
xl/_rels/workbook.xml.rels
- Order
Relationship
s byType
- Order
- For the relationships entry
docProps/core.xml
- Remove the
creator
,created
,lastModifiedBy
, andmodified
elements
- Remove the
using var sourceStream = File.OpenRead(packagePath);
await DeterministicPackage.ConvertAsync(sourceStream, targetStream);
using var sourceStream = File.OpenRead(packagePath);
await DeterministicPackage.ConvertAsync(sourceStream, targetStream);
Pi designed by Zaidan from The Noun Project.