Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Initialize interactive with Project" is missing for .Net Core Projects in Visual Studio 2019

In VS 2019 the option to initialize projects on the C# Interactive console is missing when targeting .NET Core.

enter image description here

The option is also missing in VS 2017 and there is a related question for VS 2017. However the answer to this question mainly confirms that issue but is not offering a solution.

Does anyone knows if there is a technical limitation and therefore this feature is simply not feasible for .NET Core? Anyone having a good workaround to still initialize the project (with the complete context) manually?

like image 842
Postlagerkarte Avatar asked May 08 '19 13:05

Postlagerkarte


People also ask

How do I get C# Interactive in Visual Studio?

How to launch C# REPL in Visual Studio. Click on the View menu from the Menu bar, go to the Other windows menu item, and click on C# interactive. Another way to launch the interactive compiler is to click or select a piece of code or a file and right-click and select Execute in Interactive from the context menu.

How do I use interactive in Visual Studio?

Open C# Interactive window in Visual Studio. We can open C# Interactive window in multiple ways: From Menu Bar: Go to View Menu then move the cursor to Other Windows and then click on C# Interactive.

What is C# Interactive?

C# Interactive is an advanced Read- Eval- Print- Loop (REPL) editor. We can use this window for code testing. This window gives us the flexibility of testing programs without compiling. Hence, C# interactive is better than any other alternatives like C# code editor, C# pad and Online C# compiler for executing.


1 Answers

Does anyone knows if there is a technical limitation and therefore this feature is simply not feasible for .NET Core?

I'm afraid the answer is negative.

So far this option only supports for .net framework, and not for .net core project and .net standard project temporarily.

To get this option available for .net core projects in VS it needs support from both Project-system and Roslyn. For now the Project'system work is done, you can track this issue to follow the progress of the rest work in Roslyn.

Anyone having a good workaround to still initialize the project (with the complete context) manually?

Go View=>Other Windows=>C# Interactive to get the window,and use #r command(#r "Path/MyDll.dll") to load the assembly manually.For complete context,you also need to manually load all the referenced assemblies.

Actually not a good workaround, it seems there has a way to go before the product team complete the feature, sorry for the inconvenience :-(

like image 58
LoLance Avatar answered Oct 23 '22 12:10

LoLance