Error creating package

Topics: Writing modules
Jul 8, 2011 at 8:58 PM

Hi there..

I am getting an error when I try to create a package for the module I  have created. The error is : 

Cannot add part for the specified URI because it is already in the package.
Exception Details: System.InvalidOperationException: Cannot add part for the specified URI because it is already in the package.
Stack Trace:
[InvalidOperationException: Cannot add part for the specified URI because it isalready in the package.]   at System.IO.Packaging.Package.CreatePart(Uri partUri, String contentType, CompressionOption compressionOption)   at NuGet.PackageBuilder.CreatePart(Package package, String path, Stream sourceStream)   at NuGet.PackageBuilder.WriteFiles(Package package)   at NuGet.PackageBuilder.Save(Stream stream)   at Orchard.Packaging.Services.PackageBuilder.EndPackage(CreateContext context)   at Orchard.Packaging.Services.PackageBuilder.BuildPackage(ExtensionDescriptor extensionDescriptor)   at Orchard.Packaging.Services.PackageManager.Harvest(String extensionName)   at Orchard.Packaging.Commands.PackagingCommands.CreatePackage(String extensionName, String path)


Any input is appreciated.


Thank you.

Jul 8, 2011 at 11:52 PM

Never seen this before. Can you post the command you used and the result of "dir /s" on your module directory?

Jul 11, 2011 at 7:23 PM

I had a lib directory in the module in which I had placed external dll references. Once I deleted the lib directory and moved the dll's to the bin directory, I was able to create the package. Thanks for responding.

Mar 21, 2012 at 4:02 PM

Make sure there are no duplicate <Content Include="" /> entries in your module/theme project file

Sep 11, 2012 at 4:47 PM

I had the same problem. I wanted to leave the .\Libraries directory in place, so I was able to fix it simply by no including a reference to those files in the actual .csproj file. They're still sitting in the .\Libraries folder, but since they're not referenced in the project file, they don't get included twice, and the package gets created successfully.