IntelliSense

IntelliSense is Microsoft's implementation of code completion, best known in Visual Studio

Dynamicweb supports IntelliSense for use in Visual Studio, and can be summoned in the following way:

  • Start up Visual Studio and open your project/solution
  • Add these library-references, as they'll be needed for IntelliSense to work:
    • “Website” > “Add reference…"
      • <DWroot>/Application/bin/Dynamicweb.dll
      • <DWroot>/Application/bin/RazorEngine.dll

We recommend that you set up a single solution with a single web-application project containing the entire Files folder. 

In the editor, make sure to add the following two lines to the top of every .cshtml template where you’d like to use IntelliSense:

@inherits RazorTemplateBase< RazorTemplateModel < Template > > @using Dynamicweb.Rendering

Now you should see Dynamicweb specific code completion as seen here:

Figure 1.2 Dynamicweb specific functions visible through IntelliSense (in Visual Studio 2015)

To include helper namespaces:

  • In the root of the project, create a App_Code folder
  • Add a cshtml file with helpers - e.g. MyCustomHelpers.cshtml
  • In a layout or master file (or any other razor template) add an @Include statement relative to the location of the template and the App_Code folder:
RAZOR
@Include("../../../App_Code/MyCustomHelpers.cshtml", "MyCustomHelpers")​
  • Verify that the helpers will be seen by intellisense in VS and executed on the server:
RAZOR
@MyCustomHelpers.HelperName("asdf") @MyCustomHelpers.something()