“Initialize interactive with Project” is missing f

2020-08-13 02:02发布

问题:

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

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?

回答1:

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 :-(