Development environment advices

Some advices on how to set up your development environment for Orchard Core development.

Software to install

Below you can find pieces of software that you should install for the best Orchard Core developer experience. Also check out the official documentation.

  • Visual Studio 2019 (any edition) or later installed with .NET Core development tools and the following extensions:
    • Productivity Power Tools 2017/2019 mostly for the feature of being able to clean-up unneeded using statements and for re-opening files just closed. Power Commands for similar features.
    • Editor Guidelines to add visual guides to specific line lengths (was spun out of Productivity Power Tools).
    • Attach To All The Things for quickly attaching the debugger to an IIS (Express) and other processes or ReAttach to quickly re-attach the debugger to previous debug targets. Debug Attach Manager helps with the same thing: If you select to attach a process for a given app then it'll remember it and select the suitable process the next time automatically, even after a VS restart (especially handy for .NET Core apps with their dotnet.exe processes).
    • SQLite/SQL Server Compact Toolbox for browsing Orchard's SQLite databases, or alternatively SQLite Browser (this has support to nicely format JSON documents).
    • Code Maid for various goodies, including progress indicator for builds.
    • Lombiq Orchard Visual Studio Extension with various Orchard-related features.
    • Visual Studio Spell Checker (VS2017 and Later) for avoiding typos in comments and other texts.
    • Markdown Editor to be able to edit Markdown files with a preview window (which can also be used to easily browse Markdown-formatted documentation files locally).
    • File Nesting is very handy when adding files to a project with dependencies between them (e.g. scss files with corresponding css, min.css and files).
    • Visual Studio IntelliCode to give you some personalized IntelliSense suggestions as well as generate an .editorconfig file based on your project's/solution's coding style.
    • Rewrap to reformat code comments and other text to a given line length.
    • EditorConfig Language Service if you want to edit .editorconfig files.
  • Local IIS and SQL Server (as well as SQL Server Management Studio) set up as per the following article: "How-to: running Orchard locally through IIS using SQL Server"
  • An up-to-date browser with developer-aiding tools. Recommended is Chrome with the JavaScript Errors Notifier extension to get notified of client-side errors easily (it's a bit like the Orchard Error Log Watcher feature of the Lombiq Orchard Visual Studio Extension).
  • Fiddler for inspecting any HTTP traffic.

Visual Studio tips

  • Use code snippets; try out the ones in this package too that specifically aid Orchard Core development.
  • Use keyboard shortcuts. The most useful ones are:
    • F5: start with debugging
    • Ctrl+F5: start without debugging
    • F6: build
    • F10: run to the next line, when debugging
    • F11: step into the code on the current line (e.g. if the current line is a method call this will forward you to the body of the method), when debugging
    • Ctrl+F10: run to the cursor, when debugging
    • Ctrl+.: opens the Smart Tag
    • Ctrl+Shift+Enter: adds a new line below the current line
    • F9: places a breakpoint on the current line
    • Ctrl+K, Ctrl+D: format document
    • Ctrl+K, Ctrl+C: comment selection
    • Ctrl+K, Ctrl+U: uncomment selection
    • Ctrl+,: opens the Navigate To windows (i.e. search for types or members)
    • Ctrl+D, Ctrl+E or Ctrl+Alt+E: opens the Exceptions configuration page. Tick Common Language Runtime Exceptions - Thrown to see all exceptions, even if they're caught.
    • Ctrl+Q to access the Quick Launch bar
    • Shift+Del: delete line
    • You may want to set up Ctrl+W for closing the current file for the File.Close command and Ctrl+Shift+T for Edit.UndoClose (only available if PowerCommands is installed).
  • You may want to always run VS as an administrator. This will simplify debugging web apps running in IIS since you can only attach a debugger to the IIS worker process if VS is run as an administrator.
  • To speed things up by not running a virus scan all the time on your development environment exclude the following processes from Windows Security: devenv.exe, dotnet.exe, MSBuild.exe.
  • When you start the app with the debugger attached (i.e. with F5) then by default a new browser window will open, and if you move that under an existing window as a tab the debugger will detach. To mitigate this you need to uncheck Tools → Options → Projects and Solutions → Web Projects → "Stop debugger when browser window is closed, close browser when debugging stops".

This page is part of the Orchard Dojo Library!

This page and many others here are part of the open-source, portable package of Orchard Core goodies: the Orchard Dojo Library for Orchard Core. The Library is freely accessible by anyone; just go to its repository to download its full content (you can even download the textual content of the Library as a big concatenated document in HTML), file issues or fork it! You can even edit it online on Bitbucket, just click on the Edit link in the upper right corner!

Note that the Library also has an Orchard 1.x version, check it out here!