VS Code 中的 System.Windows.Forms 程序集参考 [英] System.Windows.Forms assembly reference in VS Code

查看:31
本文介绍了VS Code 中的 System.Windows.Forms 程序集参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在 Visual Studio 代码中为 c# 设置我的开发框架,我想使用 System.Windows.Forms 引用来设置窗口.

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.

代码:

using System;
using System.Collections;
using System.Windows.Forms;
namespace Softwaredevelopment
{
   public partial class Form1 : Form
   {
      public Form1()
      {
        //tbd
      }
   }
}

我收到错误:

缺少程序集参考.

我必须在 project.json 文件或 .csproj 文件中添加什么获得创建窗口的能力.

What do I have to add in the project.json file or the .csproj file to get the ability to create a window.

推荐答案

想通了,您可以将其添加到您的 .csproj您还可以在 C:\Windows\assembly

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>

这篇关于VS Code 中的 System.Windows.Forms 程序集参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆