First things first, I'm using .NET 4.

I'm trying to write some files to a package, and I'm encountering something strange when I do this:

using (var package = Package.Open(filename, FileMode.OpenOrCreate, FileAccess.Write))
{
    // do something with package
}

Package refers to System.IO.Packaging.Package.

The weird thing is that Package.Open method throws an exception that says:

Cannot get stream with FileMode.Create, FileMode.CreateNew, FileMode.Truncate, FileMode.Append when access is FileAccess.Read.

I found an old bug report from 2009 on Microsoft Connect: http://connect.microsoft.com/VisualStudio/feedback/details/392318/argumentexception-text-is-wrong

But it doesn't help.

So, anyone got an idea?

Edit
Report