Register an addon in Episerver CMS 12

Vote:
 

Plugin UI is developed in a separate MVC project and CMS 12 is in another project. 

Please consider followings

  1. The TestAddon project is a Simple MVC project with basic UI. We need to get this UI rendered in a CMS 12 Admin menu. We have created a menu provider as well.
  2. Then build the TestAddon project and copied DLLs to CMS-> bin folder.
  3. Created module/_protected folder and added TestAddon/TestAddon.zip
  4. module.config was created as described in the documentation
    <module productName="TestAddon" loadFromBin="false" tags="EPiServerModulePackage" clientResourceRelativePath="1.0.0">
      <assemblies>
        <add assembly="TestAddon" />
      <add assembly="TestAddon.Views" />
      </assemblies>
    
      <route url="{controller}/{action}" > 
        <defaults>
          <!--<add key="moduleArea" value="TestAddon" />-->
          <add key="controller" value="CustomAdminPage" />
          <add key="action" value="Index" />
        </defaults>
      </route>
    
      <clientResources>
        <!-- <add name="myscript" path="ClientResources/index.js" resourceType="Script" ></add> -->
      </clientResources>
    
    
      <clientModule>
        <moduleDependencies>
          <add dependency="CMS" />
          <add dependency="Shell"/>
           <add dependency="EPiServer.Cms.UI.Admin" type="RunAfter"/>
          <add dependency="EPiServer.Cms.UI.Settings" type="RunAfter"/> 
        </moduleDependencies>
        <requiredResources>
        </requiredResources>
      </clientModule>
    </module>
  1. Set Auto discovery in startup file

services.Configure<ProtectedModuleOptions>(x => x.AutoDiscovery = EPiServer.Shell.Configuration.AutoDiscoveryLevel.Modules);

When we then start the project it is giving following error:  error:

"Value cannot be null. (Parameter 'path')"

stacktrace:

at System.IO.Path.GetFullPath(String path)
   at System.IO.DirectoryInfo..ctor(String path)
   at EPiServer.Shell.Modules.ModuleFinder.GetModuleInDirectory(String routeBasePath, String moduleResourcePath, IEnumerable`1 configuredAssemblyNames, AutoDiscoveryLevel discoveryMode, String configuredName)
   at EPiServer.Shell.Modules.ModuleFinder.GetModulesInSubdirectories(String rootPath, AutoDiscoveryLevel discoveryMode)
   at EPiServer.Shell.Modules.ConfigModuleProvider.GetConfiguredModules(ModuleOptionsBase moduleInfo)
   at EPiServer.Shell.Modules.ConfigModuleProvider.GetModules()
   at EPiServer.Shell.ShellInitialization.<>c.<GetConfiguredModules>b__9_0(IModuleProvider p)
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at EPiServer.Shell.Modules.ShellModule.MergeDuplicateModules(IEnumerable`1 modules)
   at EPiServer.Shell.ShellInitialization.GetConfiguredModules(IServiceProvider locator)
   at EPiServer.Shell.ShellInitialization.Initialize(InitializationEngine context)
   at EPiServer.Framework.Initialization.Internal.ModuleNode.<>c__DisplayClass4_0.<Initialize>b__0()
   at EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key)
   at EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context)
   at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()

When we removed the auto discovery setting form startup class. It works to build the project

Does anyone have experienced this? Please point me in a correct direction

#272225
Feb 15, 2022 13:42
Vote:
 

Do you have module.config and a top level folder 1.0.0 in zipped addon?

I never tried auto discovery but have successfully added protected module options explicitly like this:

            services.Configure<ProtectedModuleOptions>(o =>
            {
                var myModuleDetails = new ModuleDetails
                {
                    Name = "MyModuleName",
                };
                o.Items.Add(myModuleDetails);
            });
#276845
Edited, Mar 22, 2022 8:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.