Zip archive and public addons

Vote:
 

Just wanted to verify that zip archives only are supported for protected modules. I tested with both protected and public modules (only difference is root folder placement and the tag value in module.config), and the Zip VPP only kicked in for the protected one. Is this the correct behavior or am I missing something?

Thanks

Frederik

#123168
Jun 25, 2015 19:47
Vote:
 

This is correct. Zip provider by default is registered for protected modules. Actually for modules that take care of this by themselves. What you would need to do is to registed your module within VirtualPathProviders. Place this somewhere inside your module:

public class ModuleZipProviderInitializer : IVirtualPathProviderModule
{
    public IEnumerable<VirtualPathProvider> CreateProviders(InitializationEngine context)
    {
        if (context.HostType != HostType.WebApplication)
        {
            return Enumerable.Empty<VirtualPathProvider>();
        }

        return new List<VirtualPathProvider>
        {
            new ZipFileVirtualPathProvider(VirtualPathUtility.ToAppRelative(VirtualPathUtility.Combine(Paths.PublicRootPath, "YourModule")),
                                           "~/modules/public/YourModule/YourModule.zip",
                                           null,
                                           context.Locate.Advanced.GetInstance<IHostingEnvironment>())
        };
    }
}
#123172
Jun 25, 2015 23:18
Vote:
 

Thanks for confirming Valdis. I guess they did that for performance reasons.

Frederik

#123176
Jun 25, 2015 23:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.