在Visual Studio代码中设置我的C#的开发框架,我想使用System.Windows.Forms
参考来设置窗口。
代码:
using System;
using System.Collections;
using System.Windows.Forms;
namespace Softwaredevelopment
{
public partial class Form1 : Form
{
public Form1()
{
//tbd
}
}
}
我得到错误:
缺少汇编参考。
我必须在project.json
文件或.csproj
文件中添加什么为了获得创建窗口的能力。
弄清楚了您可以将其添加到.csproj您还可以在此处找到名称和版本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>