To set up my development framework for c# in visual studio code,
I want to use the System.Windows.Forms refernce in order to set up a window.
Code:
using System;
using System.Collections;
using System.Windows.Forms;
namespace Softwaredevelopment
{
public partial class Form1 : Form
{
public Form1()
{
//tbd
}
}
}
I get the error:
Missing Assembly Reference.
What do I have to add in the project.json file or the .csproj file
to get the ability to create a window.
Figured it out you can add this to your .csproj You can also find the names and versions here C:\Windows\assembly
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net452</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Drawing-dotnet-core" Version="1.2.3"/>
<Reference Include="System.Windows.Forms" version="2.0.0.0" /> //< ----- add This line here
</ItemGroup>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With