This project is read-only.

Modify Module .cshtml Files at Runtime

Topics: Core, Customizing Orchard, Writing modules
Mar 21, 2013 at 8:50 PM
Does anyone know if there is a way to modify a module's .cshtml files at runtime from within Orchard? Perhaps there is a module to do this or it is already built-in within Orchard? My current understanding is that new .cshtml files may be uploaded, but I am hoping for an editor within Orchard.

Thank you in advance for considering my question!
Mar 23, 2013 at 8:23 AM
What exactly are you trying to do?
Mar 25, 2013 at 3:38 PM
Hi Bertrand! I am looking to allow administrators access to modify cshtml files associated with modules to allow the look and feel to be modified at runtime. My thinking here is that IIS will reload the files and I can allow a greater range of customization within the markup for modules. There is a theme module out there which allows theme cshtml files to be modified -- I am thinking of creating a similar module to allow this level of customization for module cshtml. Is what I am trying to do technically possible?

As a follow-up thought to this concept, it seems that I will want to be sure that modified file changes are incorporated back into the module if it is packaged. I am very interested in your thoughts on this subject Bertrand.

Mar 26, 2013 at 7:20 AM
It seems to me like it would be a lot simpler to give your administrators the proper tools to edit cshtml files.
Mar 26, 2013 at 2:18 PM
Yes, that's true... I am running Orchard in Azure as a cloud service and I don't have access to the operating system to add a FTP server and since it's cloud based, I can't open up file shares. I think this is the reason why I am thinking of a module to facilitate access to cshtml files.
Mar 27, 2013 at 8:22 AM
Never modify files in cloud services, whether it's through the app or any other way: the whole concept is that the image that you upload can be restarted at any time from scratch. The file system should never be modified on those instances.
Mar 28, 2013 at 12:52 AM
Fair enough... let's say that it's a VM in Azure with durable storage... The heart of the question is this... why not give end users the ability to modify a cshtml page via Conductor? I'm not asking the Orchard team to program this feature -- I'm just trying to get some feedback before I proceed with development of such a module.