[Visual Studio 2017][.NET Core 2.0] .NET Core 主控台應用程式編譯產生 exe 執行檔 (.NET Core 2.0 self contained development in Visual Studio 2017)

熱門文章 (Popular Post)

Posted by : Duran Hsieh 6月 07, 2018

前言

早期我們在 Visual Studio 編譯 .NET Core 時,如果要產生出 exe 執行檔案, 必須要在 .csproj 內加入
<PropertyGroup>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
</PropertyGroup>
而在 Visual Studio 2017 + .NET Core 2.0 做法開始有些不同了。您可以嘗試下列操作步驟:

操作步驟 (Operating steps)

步驟 1. 右鍵點選您的專案,選取發佈
Step 1. Right click project and select publish

步驟 2. 選擇 資料夾 → 點選 發佈 (或建立 profile,都可以)
Step 2. Select folder → click publish(or create profile, it is ok)

步驟 3. 點選設定 → Deployment mode 擇 self-contained → runtime target 選擇 win-x64 -> 點選儲存
Step 3. click configure → Deployment mode:self-contained → runtime target:win-x64 -> click save

步驟 4. 點選發佈,你會在你設定的資料夾內找到 .exe 執行檔案
Step 4. click publish, you will find .exe file under your target location

另外,您可以在 FolderProfile.pubxml 看見詳細的發佈設定。希望這文章能幫上忙
Btw, you also see the detail in FolderProfile.pubxml. Hope this helps. :)


Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Duran Hsieh @ Matsurigoto - Date A Live - Powered by Blogger - Designed by Johanes Djogan -