Setting Up a Development Environment for LINQPad Driver for Sitecore

This post explains why and how to set up a development environment for building custom components for the LINQPad Driver for Sitecore 1.8 and greater.

While I've made every effort to ensure the LINQPad Driver for Sitecore works "out of the box" and that the latest version of Sitecore is supported, I can't guarantee it will work with your particular Sitecore environment. This is because I have no idea how you've configured your environment.

For example, you might have added a custom component that is included in the initialize pipeline. The LINQPad Driver for Sitecore doesn't run all of the same initialization logic that Sitecore runs when it starts. So you need a way to tell the LINQPad Driver for Sitecore to run your initialization code.

And there are other cases where you might need the driver to do more than it does by default. I explained the various extension points the driver supports in my previous post, but here's a quick review:

  • App.config reader - reads the web.config file from the Sitecore server and makes any changes necessary in order for the file to be used as the app.config file for LINQPad.
  • Schema builder - exposes search indexes as IQueryable<T> objects in LINQPad.
  • Driver initializer - runs code to initialize the Sitecore environment that is running in LINQPad.

Warning before you start developing

I strongly recommend you extend the default components that are provided with the driver. They include logic that is required is most cases. Here is a list of the default types:

  • App.config reader - Sitecore.Linqpad.AppConfigReaders.Sitecore7AppConfigReader, Sitecore.Linqpad
  • Schema builder - Sitecore.Linqpad.SchemaBuilders.SitecoreSchemaBuilder, Sitecore.Linqpad
  • Driver initializer - Sitecore.Linqpad.DriverInitializers.SitecoreDriverInitializer, Sitecore.Linqpad

Visual Studio project setup

  1. Create a new Visual Studio project using the "Class Library" template and .NET Framework 4.5 (or greater).
  2. Use Nuget to add a reference to the package "Sitecore.Linqpad". This will add references to the LINQPad assembly and the Sitecore.Linqpad assembly.

Now you can create custom components.

Debugger configuration

You can configure the project so you can use the Visual Studio debugger by following these steps:

  • In the Visual Studio Solution Explorer, right-click on the project and select Properties.
  • Navigate to the Debug section.
  • In the Start Action section select "Start external program" and select the LINQPad.exe file. On my machine this file is located at C:\Program Files (x86)\LINQPad4\LINQPad.exe


Now you should be able to build and debug custom components. If you've found a reason to create a custom component, please share your experience in the comments. Same with any suggestions for more functionality that I should include in the default components.