This question is not answered by the proposed duplicate. There is no "Initialize Interactive with Project" option when I right click my project.
I want to test out some code without creating another project and writing a console application. My project includes a reference to System.Windows.Forms
and I can use the Forms
namespace within my project, however, I cannot use it in C# interactive due to the following error:
> using System.Windows.Forms;
(1,22): error CS0234: The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
I've done a bit of sleuthing but I can't find too much information on this feature of Visual Studio. I thought to try loading the assembly with reflection but while loading the assembly did work, C# interactive still cannot find the System.Windows.Forms
namespace:
> Assembly.LoadFile("@C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.1.0\ref\netcoreapp3.1\System.Windows.Forms.dll")`
using System.Windows.Forms;
(1,14): error CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
Do note that I made sure to run #reset core
to switch to .NET Core to match the version of the assembly I tried to load.
Whether it's using reflection to load the assembly or a more graceful method, how do I load a non-default assembly in a usable fashion within the C# Interactive pane of Visual Studio 2019?