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:
- Navigate to the DSS_Preview folder within the Ingeniux CMS installation (e.g., C:\[path-to-cms-site-instance]\DSS_Preview).
- In DSS_Preview, double-click the file named Dynamic_Site_Server_Instance.csproj. The sample project displays in the Solution Explorer.
- 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.
- Select Add > View. The Add View dialog displays.
- 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.
- 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).
- In the Options area, select Use a layout page. Layouts, Models, and Namespaces provides instructions about how to add the _viewstart file.
- Click Add. The *.cshtml file displays in the Solution Explorer pane beneath the CMSPageDefault folder. Now the view is ready for further development.