若要在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>