编辑Sitecore zip包

时间:2014-03-12 10:51:55

标签: sitecore sitecore6

简短问题:我如何拉链解压缩包?

我正在使用sitecore 6.6.0(rev.121015)我在Sitecore内部生成一个包。生成一个zip文件(HomePackage.zip)。当我解压缩它时会出现一个不同的zip - package.zip。当我解压缩package.zip时,我看到带文件的文件夹。

问题:当我用7z压缩uziped文件夹时,我创建了package.zip文件,然后当我压缩package.zip文件时,我创建了HomePackage.zip。请注意,我没有修改过任何东西。不幸的是,当我尝试安装新创建的包时(对我而言,它应该与原始类似)sitecore会抛出异常。下面列出了大量警告:

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):

然后是一个阻止一切的最终例外:

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)

我注意到我创建的package.zip(内部zip文件)是原始package.zip的两倍。如何重新压缩文件夹并重新创建包?

请不要问问题:为什么我这样做,或者他们是不同的方式来解决我的问题。我很有兴趣了解我可以使用哪种工具从已有的文件夹结构中重新创建包。

2 个答案:

答案 0 :(得分:1)

您是否检查过您的7zip文件中的所有商品是否真的存在? Sitecore包中的文件路径相当长。如果你已经将软件包解压缩到类似桌面的东西 - 7zip可以很容易地解决你尝试添加和跳过它们的一些项目的问题。

据我所知,Sitecore在这些档案的压缩/解压缩方面没有做任何特别的事情。我从未详细研究过这个问题。

答案 1 :(得分:0)

使用sitecore package.zip时,7z非常容易让人误解 该文件不完全与zip兼容,下面的文件不会被解压缩

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

我假设其中一个文件包含如何读取sitecore项目中的语言和版本号的基本数据。您可以在\ package \ installer \ project文件中找到罪魁祸首,它将如下所示:

<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>

注意字符串的结尾。应该使用语言替换不变量,使用版本号替换0,但因为缺少该信息,您会收到错误:无法解析语言“1”

这就是为什么你不应该篡改package.zip

的原因

但是,如果你必须找到一个解决方法,如何将文件添加到现有的package.zip。不幸的是有一些限制。

我必须在sitecore包之上创建一个包,但我的包只包含dll和config文件(没有序列化sitecore项的包)。 Sitecore包太大了,无法手动重新创建它,因此我使用sitecore rocks包管理器创建我的包,然后将其与sitecore包合并。

要实现这一点,我必须合并

  

\包\文件

     

\包\安装\项目

  

\包\特性\文件

您可以安全地将常规文件(如dll或配置文件)添加到原始sitecore包中。 在7z中打开package.zip(不解压缩)将合并的文件和文件夹添加到现有存档(拖放)。保留package.zip和7z会要求你覆盖。这不会触及Sitecore文件,因此它不会破坏软件包。

我不确定该方法是否适用于序列化项目,但我有一个假设,如果你将/ invariant / 0替换为/ en / 1之类的东西,它将能够安装那个语言版本而你不会需要那些不可存档的Sitecore文件。

你也可以跳过使用Sitecore rock包管理器,但我认为它有助于生成文件并理解package.zip包含的内容。