0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C# Visual Studio 2019 .NET Core 3.1 クラスライブラリプロジェクトでWindows依存機能を使う

Posted at

Visual Studio 2019の.NET Core 3.1 クラスライブラリプロジェクトは標準ではWindows依存の機能を使用できませんが、プロジェクト ファイルを編集することでWindows依存の機能を使用できます。

手順

  1. ソリューションエクスプローラーでクラスライブラリプロジェクトの名前を右クリックしてメニューを表示する。
  2. 「プロジェクト ファイルの編集」をクリックする。
  3. 内容を次の通り書き換える。具体的にはProjectのSdkを「Microsoft.NET.Sdk.WindowsDesktop」へ変更して、<UseWindowsForms>true</UseWindowsForms>を追加しています。
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
      <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>

</Project>
  • プロジェクトの設定を変更している場合はその他の要素が表示されますが、変更する部分はProjectのSdkと<UseWindowsForms>true</UseWindowsForms>の追加です。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?