【发布时间】:2018-04-09 12:00:34
【问题描述】:
我正在使用 Windows 10 和 Visual Studio 2017 为 .net core 2.0 框架生成简单的控制台应用程序。在我试图显示的应用程序中
MessageBox.Show("测试信息");
using System;
using System.Windows.Forms; // error
namespace Window
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
MessageBox.Show("Message from main (primary) thread"); // error
Console.ReadLine();
}
}
}
在生成的项目中添加依赖 SDK -> Microsoft.NETCore.App -> System.Windows.dll。
为什么我仍然会收到此错误?
【问题讨论】:
标签: c# visual-studio .net-core console-application