Adding Views to Visual Studio Project

How to Add Views in VS Project | Add view files in Visual Studio to prepare for further development.


To add a view in Visual Studio:

  1. Navigate to the DSS_Preview folder within the Ingeniux CMS installation (e.g., C:\[path-to-cms-site-instance]\DSS_Preview).
  2. In DSS_Preview, double-click the file named Dynamic_Site_Server_Instance.csproj. The sample project displays in the Solution Explorer. 
  3. In the Views folder, right-click the CMSPageDefault subfolder, which will contain the new view.

    Note: In addition to CMSPageDefault, the Views folder contains the Shared subfolder. Shared is reserved for partial view files, which are referenced by the main views contained in the CMSPageDefault folder.

  4. Select Add > View. The Add View dialog displays.

    Add View Dialog in Visual Studio

  5. In the View name field, enter the name of the associated schema type. Do not include the file extension in this field, as it will be added by Visual Studio, automatically.

    Important: The name of the view file must reflect the name of the schema that will be used to generate XML for the view. For example, if the name of one of your schemas is Home, then the associated view file name must be Home.cshtml. Be sure to match the case of your views with their associated schemas.

  6. In the Template drop-down list, you can automatically "scaffold" default view content. If you only want to create a view stub without content, then select Empty (without model).
  7. In the Options area, select Use a layout page. Layouts, Models, and Namespaces provides instructions about how to add the _viewstart file.
  8. Click Add. The *.cshtml file displays in the Solution Explorer pane beneath the CMSPageDefault folder. Now the view is ready for further development.

Next Steps: