SaaS CMS has officially launched! Learn more now.

PackageInitializer::AfterInstall, no SiteUrl and Id are available


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?


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.

public class ModulePackageInitializer : PackageInitializer

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

public class ModulePackageInitializer : PackageInitializer

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

public override void Initialize(InitializationEngine context)
    context.InitComplete += InitCompleteHandler;
Edited, Aug 07, 2017 14:04

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();

Aug 08, 2017 13:52

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

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.