Visual Studioを使用してリリースファイルを1つのexeファイルにまとめるの方法とは別の手順で1ファイル化します。
最近はこっちの手順でしかやってないです。
環境
- Visual Studio 2022 v17.6.0 Preview 1.0
- .NET 7.0
発行手順
- 発行手順プロジェクトを右クリック
![menu publish](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/menu-publish.png?resize=502%2C143&ssl=1)
- フォルダを選択(2回)
![publish dialog](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-dialog.png?resize=803%2C563&ssl=1)
![publish dialog_2](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-dialog_2.png?resize=802%2C564&ssl=1)
- 出力先を指定
デフォルトの出力先でOK
![publish dialog_3](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-dialog_3.png?resize=803%2C565&ssl=1)
- 閉じる
![publish dialog_4](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-dialog_4.png?resize=804%2C566&ssl=1)
- すべての設定を表示
![publish setting_1](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-setting_1.png?resize=868%2C361&ssl=1)
- ターゲットランタイムを変更&単一ファイルの作成にチェック
移植可能だと1ファイル化できないのでwin-64等に変更し、保存
![publish setting_2](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-setting_2.png?resize=552%2C501&ssl=1)
- 設定ファイルの確認
properties/PublishProfilesにpubxmlが作成される - 発行
発行ボタンをクリックすると指定したフォルダにexeファイルが作成される
![publish exe](https://i0.wp.com/developers-trash.com/wp-content/uploads/2023/04/publish-exe.png?resize=845%2C197&ssl=1)
release_onefile.pdb
release_onefile.exe
コメント