“Initialize Interactive with Project”– Run Interactive with context to Project–Visual Studio 2015

“Initialize Interactive with Project”– Run Interactive with context to Project–Visual Studio 2015

The Interactive Window in Visual Studio is a great utility to play around the code, language features, API’s and other .NET framework features.  The Interactive Window also support features like IntelliSense, syntax highlighting and navigating through executed commands.  There  are several use cases for this Interactive Window, and several ways to work around it. In this quick post we will see how we can run the Interactive Window with context to a Project.

Directly Initialize Interactive with Project Vs. Manual Loading of Assembly / Projects

To launch the Interactive window navigate through  Views > Other Windows > C# Interactive. Here you can add your code and execute it.

Read this post for details :  Use C# Interactive Window for your coding experiment in Visual Studio 2015

using Language Features in Interactive

The Interactive Windows works stands alone, if you want to call any of the current project methods, or want to run the context of the project you need to load the assembly at very first step.

Read This Post for Details : Calling current project methods from C# Interactive Window in Visual Studio 2015 ?

Then use #r to load the DLL or Executable in to it. for an example, #r “<dll path>”

Loading Assembly into Interactive

With the Visual Studio 2015 Update 2, you can do the same thing in much faster and cleaner way.  Right click on the project from solution explorer, and from the context menu select “Initialize Interactive with Project” option.

Initialize Interactive with Project


This will automatically load all the required assembly and the executable in the context of selected project.

Initialize Interactive with Project

 Must Read :  “Execute in Interactive”– Send to C# Interactive Window – Visual Studio 2015

Now you can use and execute other script from the context of the project inside the Interactive.

Hope this helps !

Subscribe To Newsletter For your Daily Development Tips and Tricks  

 Best Tips & Tricks on Microsoft Technology Platform 

Invalid email address
We promise not to spam you. You can unsubscribe at any time.
Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

4 Comments to ““Initialize Interactive with Project”– Run Interactive with context to Project–Visual Studio 2015”

  1. Travis Dean

    Does this also work with F# projects? It seems this feature would be even more useful there.

Comments are closed.