This project is read-only.

Error creating package

Topics: Writing modules
Jul 8, 2011 at 9: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 9, 2011 at 12:52 AM

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 8: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 5:02 PM

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

Sep 11, 2012 at 5: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.

Aug 30, 2017 at 3:37 AM
hello, I need help on how you resolve the issue. Sorry I am not a technical person so was not able to follow your statement. There is no lib directory in the module folder, so I do not know what else I can do to create the package successfully. Appreciate your help.