Я использую Microsoft Visual Studio Community 2019 Preview Версия 16.6.0 Preview 1.0. NET Core 3.1 создает приложение WinForm. Я просматриваю это видео https://youtu.be/lxbUcU4Q5Fk?t=317
Файл WindowsFormApp1.csproj
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Assembly asm = Assembly.GetExecutingAssembly();
StreamReader reader = new StreamReader(asm.GetManifestResourceStream("WindowsFormsApp1.Files.hello.txt"));
textBox1.Text = reader.ReadToEnd();
}
}
}
При нажатии кнопки [Получить текст] Ошибка:
System.ArgumentNullException: 'Значение не может быть нулевым. (Параметр 'stream') '
Как это исправить?