Kentico 9 持续集成报错

Kentico 9 Continuous Integration Error

我在做Kentico电商项目,从8.2.48版本迁移到9.0.50,目的是为了使用持续集成功能,但是现在出现错误:

Message: Serialization of object type @Product tax class@ (ECommerce.SKUTaxClass) failed for object @551, 2@ ([Unknown]: 0). See inner exception for further details.

    Exception type: CMS.ContinuousIntegration.ObjectTypeSerializationException
    Stack Trace: 
    at CMS.ContinuousIntegration.Internal.FileSystemStoreAllJob.StoreSingleObjectTypeObject(FileSystemStoreJob storeJob, ObjectTypeInfo typeInfo, String objectType, BaseInfo info, Int32 counter, Int32 total)
    at CMS.ContinuousIntegration.Internal.FileSystemStoreAllJob.@@c__DisplayClass6.@StoreAllObjectTypeObjects@b__3(BaseInfo info)
    at CMS.ContinuousIntegration.Internal.AbstractFileSystemJob.CancellableForEach[T](CancellationToken cancellationToken, IEnumerable`1 collection, Action`2 action)
    at CMS.ContinuousIntegration.Internal.AbstractFileSystemJob.CancellableForEach[T](CancellationToken cancellationToken, IEnumerable`1 collection, Action`1 action)
    at CMS.ContinuousIntegration.Internal.FileSystemStoreAllJob.StoreAllObjectTypeObjects(String objectType, Int32 counter, Int32 total)
    at CMS.ContinuousIntegration.Internal.AbstractFileSystemJob.CancellableForEach[T](CancellationToken cancellationToken, IEnumerable`1 collection, Action`2 action)
    at CMS.ContinuousIntegration.Internal.FileSystemStoreAllJob.StoreObjects()
    at CMS.ContinuousIntegration.Internal.FileSystemStoreAllJob.RunInternal(CancellationToken cancellationToken)
    at CMS.ContinuousIntegration.Internal.AbstractFileSystemAllJob.Run(Nullable`1 cancellationToken)

    Message: Serialization of the object CMS.Ecommerce.SKUTaxClassInfo (ecommerce.skutaxclass) has failed.

    Exception type: CMS.ContinuousIntegration.ObjectSerializationException
    Stack Trace: 
    at CMS.ContinuousIntegration.Internal.AbstractSingleObjectJob.Run(BaseInfo baseInfo)
    at CMS.ContinuousIntegration.Internal.FileSystemStoreAllJob.StoreSingleObjectTypeObject(FileSystemStoreJob storeJob, ObjectTypeInfo typeInfo, String objectType, BaseInfo info, Int32 counter, Int32 total)

    Message: Missing site ID value for object AAA. Object type does not support global objects.

    Exception type: System.Exception
    Stack Trace: 
    at CMS.DataEngine.TranslationReferenceLoader.LoadFromInfoObject(BaseInfo info)
    at CMS.ContinuousIntegration.FileSystemBindingsProcessor.CreateParentElement(XmlNode rootElement, BaseInfo parent)
    at CMS.ContinuousIntegration.FileSystemBindingsProcessor.PrepareNewDocument(String relativePath, BaseInfo parent, String rootElementName)
    at CMS.ContinuousIntegration.CachedFileSystemBindingsProcessor.PrepareNewDocument(String relativePath, BaseInfo parent, String rootElementName)
    at CMS.ContinuousIntegration.FileSystemBindingsProcessor.AppendBindingInternal(BaseInfo binding, String relativePath)
    at CMS.ContinuousIntegration.CachedFileSystemBindingsProcessor.AppendBindingInternal(BaseInfo binding, String relativePath)
    at CMS.ContinuousIntegration.Internal.FileSystemStoreJob.StoreBaseInfo(BaseInfo baseInfo, String relativePath)
    at CMS.ContinuousIntegration.Internal.AbstractSingleObjectJob.Run(BaseInfo baseInfo)

对象 AAA 是设置为(全局)并在 2 个站点中使用的产品的产品选项。所以这些对象被 Kentico admin ui 设置为全局对象,我不明白为什么 CI 不能按原样处理它们?

p.s。我是 Kentico 的超级新手,真的需要你的帮助 (:

最后一条消息指出:

Message: Missing site ID value for object AAA.

因此请尝试将该选项分配给您的网站。

简而言之,将此 class(或直接使用附加文件)放在项目的 (Old)App_Code 文件夹中的任意位置。应用程序将重新启动(在代码文件更改后)并且 CI 应该可以正常工作。

using CMS.Base;
using CMS.Ecommerce; 
using CMS.DataEngine; 
[SystemObjectCustomizationLoader] public partial class CMSModuleLoader {
        /// <summary>
        /// Custom attribute class for the CMSModuleLoader.
        /// </summary>
        private class SystemObjectCustomizationLoaderAttribute : CMSLoaderAttribute
        {
            /// <summary>
            /// Called automatically when the application starts.
            /// </summary>
            public override void Init()
            {
                // Allows global objects support for product options and variants. Fixes issue with CI serialization of global products with options or global variants having global taxes. 
                SKUInfo.TYPEINFOOPTIONSKU.SupportsGlobalObjects = true;
                SKUInfo.TYPEINFOVARIANT.SupportsGlobalObjects = true;
            }
        } }

(с) Zdenek Cetkovsky,电子商务高级支持专家