Frage

Short question: How Can I zip unzipped package?

I am using sitecore 6.6.0 (rev. 121015) I am generating a package inside Sitecore. A zip file is generated (HomePackage.zip). When I unzip it a different zip shows up - package.zip. When I unzip package.zip I see folders with files.

The problem: When I zip uziped folders with 7z, I create package.zip file, then when I zip package.zip file I create HomePackage.zip. Notice that I haven't modified anything. Unfortunately when I try to Install newly created package (As for me it should be similar to original) sitecore throws exceptions. listed below plenty of warnings:

items/master/sitecore/content/Home/Products/Europe/Eastern Europe/Treasures of the Balkans/Summer 2015/Treasures of the Balkans/Itinerary/Day Seventeen/
ManagedPoolThread #3 10:20:48 WARN  Cannot parse reference 'items/master/sitecore/content/Home/Products/Europe/Eastern Europe/Treasures of the Balkans/Summer 2015/Treasures of the Balkans/Itinerary/Day Nine/{24348D51-7070-4B43-AD4F-E8DA902468E8}/en/1/'
Exception: System.ArgumentException
Message: Could not parse the language '1'. Note that a custom language name must be on the form: isoLanguageCode-isoRegionCode-customName. The language codes are two-letter ISO 639-1, and the regions codes are are two-letter ISO 3166. Also, customName must not exceed 8 characters in length. Valid example: en-US-East. For the full list of requirements, see: http://msdn2.microsoft.com/en-US/library/system.globalization.cultureandregioninfobuilder.cultureandregioninfobuilder.aspx
Source: Sitecore.Kernel
   at Sitecore.Globalization.Language.Parse(String name)
   at Sitecore.Install.Items.ItemReference.Parse(String reference)
   at Sitecore.Install.Items.ItemKeyUtils.GetReference(String key):

And then a final exception that stops everything:

ManagedPoolThread #3 10:20:51 INFO  Cache created: 'rules' (max size: 800KB, running total: 402MB)
ManagedPoolThread #3 10:20:51 ERROR Error installing items/master/sitecore/content/Home/Products/Europe/Independent Breaks and Mini TRIPS/World War 1 Battlefields/Summer 2015/World War 1 Battlefields/Sightseeing highlights/1 Vimy Ridge/{694AB1C9-F690-445F-9E4A-2F1BD0CC1E09}/en/
Exception: System.ArgumentException
Message: Empty strings are not allowed.
Parameter name: itemName
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName)
   at Sitecore.Data.Engines.DataCommands.AddFromTemplateCommand.Initialize(String itemName, ID templateId, Item destination, ID newId)
   at Sitecore.Data.Engines.DataEngine.GetAddFromTemplateCommand(String itemName, ID templateId, Item destination, ID newId)
   at Sitecore.Install.Items.ItemInstaller.CreateLightweightItem(ItemReference item, XmlVersionParser parser)
   at Sitecore.Install.Items.ItemInstaller.InstallItem(BehaviourOptions installOptions, Item targetItem, ItemReference item, XmlVersionParser parser)
   at Sitecore.Install.Items.ItemInstaller.GetVersionInstallMode(PackageEntry entry, ItemReference reference, XmlVersionParser parser, ItemInstallerContext context)
   at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)

ManagedPoolThread #3 10:20:51 ERROR Installation failed: System.ArgumentException: Empty strings are not allowed.
Parameter name: itemName
   at Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName)
   at Sitecore.Data.Engines.DataCommands.AddFromTemplateCommand.Initialize(String itemName, ID templateId, Item destination, ID newId)
   at Sitecore.Data.Engines.DataEngine.GetAddFromTemplateCommand(String itemName, ID templateId, Item destination, ID newId)
   at Sitecore.Install.Items.ItemInstaller.CreateLightweightItem(ItemReference item, XmlVersionParser parser)
   at Sitecore.Install.Items.ItemInstaller.InstallItem(BehaviourOptions installOptions, Item targetItem, ItemReference item, XmlVersionParser parser)
   at Sitecore.Install.Items.ItemInstaller.GetVersionInstallMode(PackageEntry entry, ItemReference reference, XmlVersionParser parser, ItemInstallerContext context)
   at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)
   at Sitecore.Install.Items.ItemInstaller.Flush()
   at Sitecore.Install.Items.LegacyItemUnpacker.Flush()
   at Sitecore.Install.Framework.SinkDispatcher.Flush()
   at Sitecore.Install.Utils.EntrySorter.Flush()
   at Sitecore.Install.Framework.EntryBuilder.Flush()
   at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink)
   at Sitecore.Install.Utils.EntrySorter.Populate(ISink`1 sink)
   at Sitecore.Install.Installer.InstallPackage(String path, Boolean registerInstallation, ISource`1 source, IProcessingContext context)
   at Sitecore.Install.Installer.InstallPackage(String path, ISource`1 source, IProcessingContext context)
   at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.AsyncHelper.<Install>b__0()
   at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.AsyncHelper.CatchExceptions(ThreadStart start)

I noticed that the package.zip that I create (the inner zip file) is twice as large as original package.zip. How can I zip my folders again and recreate a package?

Please do not ask question: Why am I doing it, or if their is a different way to solve my problem. I am just interesting to learn what tool can I use to recreate a package from already existing folder structure.

War es hilfreich?

Lösung

Did you check that all of your items actually made it inside your 7zip file? The file paths inside a Sitecore package get quite long. And if you've unzipped the package to something like your desktop - 7zip can quite easily end up in trouble with some of the items you're trying to add and skip them.

As far as I am aware, Sitecore doesn't do anything special in the zipping/unzipping of these archives. I have never looked into this in any detail though.

Andere Tipps

7z is very misleading when working with sitecore package.zip that file is not entirely zip compatible files below won't be unziped

\package\metadata\sc_comment.txt
\package\metadata\sc_packageid.txt
\package\metadata\sc_poststep.txt
\package\metadata\sc_publisher.txt

I assume one of those files contains essential data how to read language and version number in sitecore items. You can find the culprit in \package\installer\project file, it will look like this:

<x-item>/master/sitecore/content/Home/Products/Europe/Independent Breaks and Mini TRIPS/World War 1 Battlefields/Summer 2015/World War 1 Battlefields/Sightseeing highlights/1 Vimy Ridge/{694AB1C9-F690-445F-9E4A-2F1BD0CC1E09}/invariant/0</x-item>

Notice end of the string. Invariant should be replaced with language and 0 with version number but because that information is missing you get the error: Could not parse the language '1'

This is reason one why you should not tamper with package.zip

But if you have to I've found a workaround how to add your files to existing package.zip. Unfortunately with some limitations.

I had to create a package on top of sitecore package but my package contained only dll's and config files (package without serialised sitecore items). Sitecore package was too big to manually recreating it so I used sitecore rocks package manager to create my package and then merged it with sitecore package.

To achieve that I had to merge

\package\files

\package\installer\project

and

\package\properties\files

You can safely add regular files like dll's or config files to original sitecore package. Open package.zip in 7z(don't unpack) add your merged files and folders to that existing archive(drag&drop). Leave the package.zip and 7z will ask you to overwrite. That doesn't touch Sitecore files hence it won't corrupt the package.

I am not sure if that method will work with serialised items but I have a hypothesis that if you replace /invariant/0 to something like /en/1 it will be able to install that one language version and you woudn't need those nonzipable Sitecore files.

You can also skip using Sitecore rocks package manager but I think it helps to generate files and understand what package.zip consist of.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top