SaaS CMS has officially launched! Learn more now.

PackageInitializer::AfterInstall, no SiteUrl and Id are available

Vote:
 

We are trying to acces `SiteDefinition.Current` at the time of `AfterInstall`. What we need is `SiteUrl` and `Id` but it seems that at the time of this event they are not available.

How can we postpone the calling of `AfterInstall` or otherwise, could we attach an event listener in `AfterInstall` that can later in the pipeline provide us the data?

Update:

From what I can see in the documentation and from here (enumerating the order of the execution of dependencies), decorating the class like the following should have EPiServer.Web initialized, and  by extent, SiteDefinition.Current.

[InitializableModule]
[ModuleDependency(typeof(Web.InitializationModule))]
public class ModulePackageInitializer : PackageInitializer


I first add the following attributes to the class with no results.

[InitializableModule]
[ModuleDependency(typeof(EPiServer.Packaging.PackageInitializer))]
public class ModulePackageInitializer : PackageInitializer


Adding a event handler to the InitComplete still doesn't get the values:

public override void Initialize(InitializationEngine context)
{
    base.Initialize(context);
    context.InitComplete += InitCompleteHandler;
    [...]
#181043
Edited, Aug 07, 2017 14:04
Vote:
 

It seems that the only solution that we've found is via SiteDefinitionRepository. You will not get the Current SiteDefininiton but all possible values.

var siteDefinitionRepository = ServiceLocator.Current.GetInstance<SiteDefinitionRepository>();
var siteDefinitions = siteDefinitionRepository.List().ToList();



#181082
Aug 08, 2017 13:52
Vote:
 

Is your IIS app pool set to "start automatically"?

#181083
Aug 08, 2017 13:52
* 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.