Page tree
Skip to end of metadata
Go to start of metadata

Views can either be precompiled into HTML/CSHTML by the developer, or they can be compiled at runtime by the framework. Default implementation is to have them precompiled. If you want to have them compiled at runtime, follow the steps below

Step-by-step guide

  1. Guarantee that the views (xvc files) to be compiled at runtime are set as embedded resources in the project
  2. Open web.config and look for the section "appSupportLibSettings"
  3. Inside that section add the following markup:

    <viewsCompilation mode="Runtime" localizeViews="true">
      <containerAssemblies>
        <add assembly="CompanyName.ProjectName" />
      </containerAssemblies>
      <containerPaths>
        <add name="DevelopmentEnvViewsPath" value="D:\git\project\src"/>
            
        <!-- just an example-->
        <add name="ProductionEnvViewsPath" value="D:\git\project\src"/> 
        <add name="StagingEnvViewsPath" value="D:\git\project\src"/> 
        <add name="TestingEnvViewsPath" value="D:\git\project\src"/>     
      </containerPaths>
    </viewsCompilation>

 

The containerAssemblies property is optional. You can define it if you want to specify which assemblies contain the views (xvc files) to be compiled. The value of this attribute should be either the fullname of the assembly, or a partial name (eg: If you enter "CompanyName", the lookup will target all assemblies whose name starts with "CompanyName").

The containerPaths property is also optional. You can use it if you want to read files directly from the disk instead of reading them from assembly embedded resources. Usually, this is helpful for development environments where you wish to be able to edit views without forcing a recompilation of the entire assembly

 

Note that if both properties are specifyed, the lookup order is the following: paths -> assembly embedded resources.