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?

vscodeで自己完結型の単一ファイルのexeをコンパイルする方法(vb.net)

Last updated at Posted at 2025-05-07

VS CodeでVB.NETの自己完結型単一ファイルのEXEをコンパイルする方法を紹介します。

1. プロジェクトの作成

まず、VB.NETのプロジェクトを作成します。

dotnet new winforms -lang vb -o MyApp
cd MyApp

2. vbproj ファイルの設定

プロジェクトファイル (MyApp.vbproj) を開き、以下の設定を追加します。

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <PublishSingleFile>true</PublishSingleFile>
    <SelfContained>true</SelfContained>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
  </PropertyGroup>
</Project>

3. EXEファイルのコンパイル

以下のコマンドを実行して、自己完結型の単一ファイルEXEを作成します。

dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true

4. 出力ファイルの確認

発行されたEXEファイルは、以下のディレクトリに生成されます。

MyApp\bin\Release\net8.0\win-x64\publish\MyApp.exe

このEXEファイルは**.NETランタイムなしで動作**します。

参考情報

詳しい手順は、Qiitaの記事Microsoftの公式ドキュメントを参考にしてください。

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?