We're currently setting up a CMS 7 project, trying to understand what should go into source control and how things should be deployed.
It seems Modulesbin is updated by Add-ons so I think we've got that covered. But then we have the AppData* folders. It seems they are also used for Add-ons, and to some extent the contents seem to be the same as Modulesbin. In a default installation of CMS 7, AppData is located outside the web root. What's the suggested way to handle this folder. And how should it be deployed? Should we rather put AppData inside the site? Does this folder need write perms?
Related question: the modules folder is never touched by Episerver/Add-ons - it is just for our own gadgets, like in CMS 6?
Thanks in advance!
The folders that might be updated by the add-ons system are:
The AppData folder should be outside the the site folder.
The "modules" folder under the site root still can be used for your own gadgets and so on.
So basically you're saying that all these folders are used for add-ons? Can't really see why we need four folders for this? What's the difference between public and protected add-on? So how should we set it up with source control and deploy if we want to do managed deploys? (i.e. not letting the customer update ad hoc). Having stuff outside the site root seems a bit more complicated, or is it just me?
This post http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=69988&epslanguage=en suggests that modulesrepository is used for NuGet and not add-ons? Teh confusion... :-|
The modulesbin folder is a probing path for Add-Ons assemblies. There are several reasons to have a separate folder for Add-Ons assemblies. One of them is that Add-Ons assemblies are not mixed with the site assemblies in the bin folder. Another reason is that ASP.NET restarts the site if a new assembly is placed in the site bin folder and we would like to avoid this.
Content of public Add-Ons by default is available for any site user. Protected Add-Ons content by default is accessible only for WebEditors and WebAdmins.
ModulesRepository is a folder that contains package files only for installed Add-Ons (not NuGet packages that can be installed from Visual Studio). The package files are needed when Add-On is about to be deleted or updated, since system needs to know which files belongs to which Add-On.
Here you can find more information about the Add-Ons system: http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/Add-Ons/Add-Ons.htm&vppRoot=/SdkDocuments//EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/
Having some content outside the site root folder is common way to handle files in EPiServer - Global files, Page files, Admin/Edit mode UI and Add-Ons.
If I want to relocate ModulesRepository folder, where can I change the config for that? I have searched the entire project and it's nowhere to be found... :-|
Regarding the ModulesRepository, the package is needed for Add-On system to know about all files related to the Add-On (for example all Add-Ons assemblies placed to modulesbin, not Modules folder).
Regarding your widget, probably your need to add a reference to your dojo module in the Add-Ons module.config (see here):
<add name="MyAddOn" path="ClientResources\Scripts" />
Okay, so now I have the following:
<add name="mynamespace_part1" path="Scripts/gadgets" />
In my module VS project, the JS-file that defines the module is located in /ClientResources/Scripts/gadgets/mynamespace_part2/MyAddOn.js
When I visit the CMS Edit tab in the episerver interface, I just get a blank screen (the add-on is to be inserted as an assert). Debugging with Firebug, I can see the last request from the page is a request for the JS-file which fails with 404 not found. The request is http://mysite:17000/ClientResources/Scripts/gadgets/mynamespace_part2/MyAddOn.js.
So, although I have deployed my module to ModulesRepository, the loader is looking inside the wwwroot folder. What am I missing?
EDIT: If I add the JS-file manually to the requested location, everything works. But if that is needed, it doesn't make sense to have as a part of the Nuget package. So that is not an option.
Dojo module should be registered in module.config of your Add-On. Add-Ons module.config is placed in the Add-Ons root folder. In your case, I guess, it will be wwwroot\modules\MyAddOn\module.config
Okay, so I have now added module.config to wwwroot\modules\MyAddOn\, with the content stated above. I still get a 404 but now it requests http://mysite:17000/modules/MyAddOn/Scripts/gadgets/mynamespace_part2/MyAddOn.js. I guess the path (Scripts/gadgets) given in module.config is incorrect? How can I refer to the JS found in my Nuget module?
Sorry, but I am a bit confused about this add-on architecture.
The path parameter, specified in the module.config should be relative to the Add-Ons root folder. Here is a good explanation about it: http://tedgustaf.com/blog/2014/6/create-an-episerver-widget-for-edit-mode/
Yeah, but the article does not explain how to refer to a module that is outside the wwwroot, which it is in my case, as the Nuget package is located in /appdata/MyAddOn/.With the information from the article, my understanding of the situation is now this: My module.config declares a base namespace called 'mynamespace_part1' and sets up a virtual path to 'Scripts/gadgets'. In my definition of the widget, I gave the namespace as 'mynamespace_part1.mynamespace_part2'. According to the article, this should make the loader look for the file in ClientResources/Scripts/gadgets/mynamespace_part2. But as the module.config file is located in wwwroot/modules/MyAddOn/ it seems to be looking in wwwroot/modules/MyAddOn/Scripts/gadgets/mynamespace_part2 and not in ClientResources.Is something missing from my module.config to point to the ClientResources found in my Nuget package? Can you explain where this ClientResources folder of my Nuget package is found virtually to the site?
By the way, the link to explaining the add-on system seems broken. Can you update it? I mean this one: http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/Add-Ons/Add-Ons.htm&vppRoot=/SdkDocuments//EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/
Which version of EPiServer are you using? There were some changes in Add-Ons deployment, so the blog post about dev environmnet for Add-Ons might be outdated.
I am using 7.5. I finally got it to work with the following setup:
<module productName="MyAddOn" clientResourceRelativePath="ClientResources" loadFromBin="false">
<add assembly="MyAddOn" />
<add name="mynamespace_part1" path="Scripts/gadgets" />
Now it works, and the JS file is referenced to as http://mysite:17000/episerver/MyAddOn/ClientResources/Scripts/gadgets/mynamespace_part2/MyAddOn.js (where episerver is the virtual path of the EPiServer interface on my site)