Geta / geta-optimizely-sitemaps

Search engine sitemaps.xml for Optimizely CMS 12 and Commerce 14
Apache License 2.0
10 stars 14 forks source link

Unable to find a module by assembly Geta.Optimizely.Sitemaps, Version=3.0.2.0 #67

Closed dariusz-wozniak closed 2 years ago

dariusz-wozniak commented 2 years ago

After installation of the Geta.Optimizely.Sitemaps and Geta.Optimizely.Sitemaps.Commerce, I have the System.ArgumentException: Unable to find a module by assembly 'Geta.Optimizely.Sitemaps, Version=3.0.2.0, Culture=neutral, PublicKeyToken=null' (Parameter 'moduleAssembly') error after deployment.

Note:

  1. It happens only after deployment. Works fine locally.
  2. Versions (both CMS and Commerce) are 3.0.2.
  3. Invocation code in the Startup file:
services.AddSitemaps(options =>
{
    options.EnableLanguageDropDownInAdmin = false;
    options.EnableRealtimeCaching = true;
    options.EnableRealtimeSitemap = false;
});

services.AddSitemapsCommerce();
  1. There's an invocation code for the MapRazorPages as well.
  2. Target framework is .NET 6.

Similar thread for 1.x RC version: https://github.com/Geta/geta-optimizely-sitemaps/issues/26


Stack:

2022-11-03T07:36:18.466390688Z fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]

2022-11-03T07:36:18.466468789Z       An unhandled exception has occurred while executing the request.

2022-11-03T07:36:18.466474789Z       System.ArgumentException: Unable to find a module by assembly 'Geta.Optimizely.Sitemaps, Version=3.0.2.0, Culture=neutral, PublicKeyToken=null' (Parameter 'moduleAssembly')

2022-11-03T07:36:18.466480389Z          at EPiServer.Shell.Paths.ToResource(Assembly moduleAssembly, String moduleRelativeResourcePath)

2022-11-03T07:36:18.466484889Z          at Geta.Optimizely.Sitemaps.MenuProvider.GetMenuItems()

2022-11-03T07:36:18.466489589Z          at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()

2022-11-03T07:36:18.466494389Z          at EPiServer.Shell.Navigation.MenuAssembler.GetMenuItems(String parentPath, Int32 relativeDepth)

2022-11-03T07:36:18.467672102Z          at EPiServer.Shell.Navigation.MenuAssembler.GetMenuHierarchy(String rootPath, Int32 relativeDepth, String selectionPath)

2022-11-03T07:36:18.467704003Z          at EPiServer.Shell.Web.Internal.NavigationService.GetCurrentProduct()

2022-11-03T07:36:18.467711503Z          at EPiServer.Shell.Web.Internal.NavigationService.GetCurrentProductId()

2022-11-03T07:36:18.467716803Z          at EPiServer.Shell.Navigation.MenuHelper.CreateMenuRootElement()

2022-11-03T07:36:18.467721603Z          at EPiServer.Shell.Navigation.MenuHelper.CreatePlatformNavigationMenu()

2022-11-03T07:36:18.467726803Z          at AspNetCoreGeneratedDocument.CmsUIViews_Views_Shared_Bootstrapper.b__7_2()

2022-11-03T07:36:18.467741703Z          at Microsoft.AspNetCore.Mvc.Razor.RazorPage.RenderSectionAsyncCore(String sectionName, Boolean required)

2022-11-03T07:36:18.467747003Z          at Microsoft.AspNetCore.Mvc.Razor.RazorPage.RenderSection(String name, Boolean required)

2022-11-03T07:36:18.467751503Z          at Microsoft.AspNetCore.Mvc.Razor.RazorPage.RenderSection(String name)

2022-11-03T07:36:18.467756003Z          at AspNetCoreGeneratedDocument.CmsUIViews_Views_Shared_Sleek.b__12_1()

2022-11-03T07:36:18.467761103Z          at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()

2022-11-03T07:36:18.467766303Z          at AspNetCoreGeneratedDocument.CmsUIViews_Views_Shared_Sleek.ExecuteAsync()

2022-11-03T07:36:18.467771103Z          at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)

2022-11-03T07:36:18.467788504Z          at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)

2022-11-03T07:36:18.467794104Z          at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)

2022-11-03T07:36:18.467798804Z          at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)

2022-11-03T07:36:18.467803704Z          at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)

2022-11-03T07:36:18.467808904Z          at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)

2022-11-03T07:36:18.467829704Z          at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
dariusz-wozniak commented 2 years ago

That change helped:

    <None Update="modules\_protected\Geta.Optimizely.Sitemaps\Geta.Optimizely.Sitemaps.zip">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>

Would be nice to include it in the documentation ;)