Some advice 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 2022 (any edition) or later installed with "ASP.NET and web development" tools and the following extensions:
- Productivity Power Tools 2022 but the following individual extensions are the only ones recommended:
- Fix Mixed Tabs 2022
- Match Margin 2022 if you're not using the map mode for the vertical scroll bar.
- Shrink Empty Lines 2022
- Time Stamp Margin 2022
- Code Cleanup On Save to run code cleanup profiles on save.
- Editor Guidelines to add visual guides to specific line lengths.
- Attach To All The Things for quickly attaching the debugger to an IIS (Express) and other processes. Debug Attach Manager is for a similar goal: 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 apps with their dotnet.exe processes). Similarly, ReAttach to quickly re-attach the debugger to previous debug targets.
- SQLite/SQL Server Compact Toolbox for browsing Orchard's SQLite databases, or alternatively SQLite Browser (this has support to nicely format JSON documents).
- Lombiq Orchard Visual Studio Extension with various Orchard-related features.
- Visual Studio Spell Checker (VS2022 and Later) for avoiding typos in comments and other texts.
- Rewrap to reformat code comments and other text to a given line length.
- Open Command Line to quickly open a PowerShell or other command line window in a solution or project.
- 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"
- 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, node.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 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!