0

How can I add an assembly reference to my project without using Visual Studio? I don't exactly know what an assembly reference is, but I'm being told I'm missing one and answers to my problem tend to start with "Right click here in Visual Studio...".

Code:

using System.Windows.Forms;

Error:

The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
  • You are using the wrong project type. Start a new project and select Window Form project. – jdweng Feb 23 '22 at 17:12
  • When you go to create a windows form project you should use the "dotnet new winforms" command to create a winforms project. Which is where I am assuming you went wrong. If you just want to know how to add refferences in vscode try https://stackoverflow.com/questions/42000798/how-do-i-add-assembly-references-in-visual-studio-code – Daniel Kelsch Feb 23 '22 at 17:12
  • Why not use Visual Studio though? It was created specifically for developing C# (and other .NET/C++) applications. You'll have a much easier time using it than you will trying to make programs in VSCode. – Jesse Feb 23 '22 at 17:48
  • @Jesse Multiple reasons: I don't have much space on my pc, and VS wouldn't help with that. Two, I like the idea of having one IDE for all languages. C# is the first language I have used in VSCode that is lacking support. Java, Python, C++, HTML / CSS / JS all work great in VSCode. – Adriaan Feb 24 '22 at 20:13

1 Answers1

0

When you go to create a windows form project you should use the "dotnet new winforms" command to create a winforms project. Which is where I am assuming you went wrong. If you just want to know how to add refferences in vscode try How do I add assembly references in Visual Studio Code?.

Daniel Kelsch
  • 393
  • 2
  • 10