Search code examples
.netwinformsvisual-studio-2019.net-assemblyassemblies

Where is System.Windows.Forms assembly


I have Visual Studio 2019, and an empty .net framework project. I would like to build a windows forms project by code only (without using any template).

For this goal I need System.Windows.Forms assembly:

Right click on the project --> Add --> Reference --> COM ---->Where is that assembly?

p.s There is something which is called System_windows_forms ('-' instead of '.'), and this is not what I'm looking for.


Solution

  • Add -> Reference -> Assemblies: Framework

    System.Windows.Forms is part of the .NET Framework and is installed in the Global Assembly Cache (GAC). Visual Studio will find the reference without you having to look for the location. Where exactly the assembly is located is a complicated story, since you are actually referencing a 'Reference Assembly' that is related to the framework version you are targeting, and live under the Visual Studio install path. At runtime, the assembly in the GAC will be used. The GAC is a directory under C:\Windows\Microsoft.NET,