Advanced Setup

Do advanced Razor setup tasks

Changing the Root Folder for Razor Functions Files

By default, you are supposed to put all the cshtml files in ~/App_Data/Razor, which serves as the root folder for Razor Function files.

You can change the root folder, for example, to ~/MyRazorFunctions.

  1. Edit composite.config.
  2. Locate configuration/Composite.Functions.Plugins.FunctionProviderConfiguration/FunctionProviderPlugin/add[@name="CompositeC1Contrib.RazorFunctions"].
  3. Change the directory attribute's value to a different folder (e.g. ~/MyRazorFunctions).

You can also have several instances of the Razor Functions provider (under different names) pointing to different root folders:

 
<configuration> 
  <!-- other sections --> 
  <Composite.Functions.Plugins.FunctionProviderConfiguration> 
    <FunctionProviderPlugins> 
      <!-- other providers  --> 
      <add type="CompositeC1Contrib.RazorFunctions.FunctionProvider.RazorFunctionProvider, CompositeC1Contrib.RazorFunctions" name="CompositeC1Contrib.RazorFunctions" directory="~/App_Data/Razor" /> 
      <add type="CompositeC1Contrib.RazorFunctions.FunctionProvider.RazorFunctionProvider, CompositeC1Contrib.RazorFunctions" name="MyRazorFunctions" directory="~/MyRazorFunctions" /> 
    </FunctionProviderPlugins> 
  </Composite.Functions.Plugins.FunctionProviderConfiguration> 
</configuration>

Note: The cshtml file cannot be placed directly in the root Razor Functions folder (like ~/App_Data/Razor/Function.cshtml). It must be placed in at least one subfolder that will serve as the namespace for the function: ~/App_Data/Razor/Demo/Function.cshtml > Demo.Function.