1
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?

Windows でしか動かなくていいの

Last updated at Posted at 2025-02-06

CA1416 の警告がウザい

のでメモ。

Windows でしか動作しないアプリなので良いいの!

メソッドごとは面倒なのでクラス毎まとめて指定しちゃう。

namespace FooBarApp
{
    [SupportedOSPlatform("windows")]    // <---これ
    internal class HogeHogeClass
    {

    // 以下略

新しいスタイルだと Program.cs に関数書かないんだけど!
という場合はこう書けばよろし。

if (OperatingSystem.IsWindows())   // <--- これ
{
    // なにかする
}

return 0;
1
0
2

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
1
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?