System.IO.Packaging has different behavior on different computers
I have multiple vms, all have office 2007 and windows 2003, and I created a simple hello-world C# windows application that makes a package with a single xml file as a package part. On one VM, the package creates a folder structure inside the package according to the URI of the package part that I add to the package. On all other computers I try, the package does not create a folder structure, it adds all package parts to the root of the package, no matter what URI i provide. my source code is below. Any explanations?
Code Snippet
using
System;using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Drawing;using
System.Text;using
System.Windows.Forms;using
System.IO.Packaging;using
System.IO;using
System.Xml;namespace
PackageProject{
publicpartialclassForm1 :Form{
public Form1(){
InitializeComponent();
Package _package =Package.Open(@"C:\PackageTestTest.zip",FileMode.Create,FileAccess.ReadWrite);Uri uriDefaultContentType =newUri("/default.xml",UriKind.Relative);PackagePart partTemp = _package.CreatePart(uriDefaultContentType,"application/xml");XmlDocument workbook =newXmlDocument();_package.DeletePart(uriDefaultContentType);
Uri uriWorksheet =newUri("/Pages/Page1/sheet1.xml",UriKind.Relative);PackagePart worksheetPart = _package.CreatePart(uriWorksheet,@"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml");_package.Flush();
}
}
}

