0%

20180705工作日誌(CoreRT)

[接續昨天] NET Core 發布時輕量化 剩下一個.exe檔好棒棒

Github : CoreRT

Github : CoreRT Pre-Requisites

  1. 安裝Visual Studio 2017 包含Visual C++
  2. 安裝CMake(安裝程式中記得把PATH給設定上去)

Github : CoreRT照著步驟做

  1. Clone CoreRT的專案原始碼
  2. Build它
    build[.cmd|.sh] clean [Debug|Release]
    • 應該會跑一段時間
    • 會Restore所有的Nuget Project
    • 最重要的ILCompiler放在\bin<OS>..\tools.
    • 自動build & test (我test總會有三個沒過)
  3. 別忘記安裝 .NET Core SDK
  4. 開啟你CMD,ㄜ不是,是x64 Native Tools Command Prompt for VS 2017
  5. 真的要開啟 x64 Native Tools Command Prompt for VS 2017 不是CMDㄛ
  6. 開啟 x64 Native Tools Command Prompt for VS 2017
  7. 編輯你的.csproj檔案 加入以下這些
    1
    2
    3
    4
    <project>  
    <Import Project="$(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\Sdk.targets" Condition=" '$(Configuration)' != 'Debug'" />
    <Import Project="$(IlcPath)\build\Microsoft.NETCore.Native.targets" Condition=" '$(Configuration)' != 'Debug'" />
    </project>
  8. 切到你的專案下 輸入這個
    1
    dotnet publish --configuration Release --runtime win-x64 /p:IlcPath=<repo_root>\bin\<OS>.<arch>.<Config>
    以我的例子來舉例的話就像下面醬子
    1
    dotnet publish --configuration Release --runtime win-x64 /p:IlcPath=D:\Patrick\corert\bin\Windows_NT.x64.Debug
  9. 江江,在 bin\x64\Release\netcoreapp2.1\win-x64\publish\ 寶藏都在那了