Publish .NET Core App As Portable Executable

前端 未结 3 1370
暖寄归人
暖寄归人 2020-12-01 07:05

I have a simple .net core app and publish it by following command:

 dotnet publish -c Release -r win10-x64

SqlLocalDbStarter.csproj

3条回答
  •  不思量自难忘°
    2020-12-01 07:17

    This documentation from Microsoft uses the same dotnet publish -c Release -r win10-x64 that you have used, and documents it as follows (emphasis added):

    This creates a Release (rather than a Debug) version of your app for each target platform. The resulting files are placed in a subdirectory named publish that's in a subdirectory of your project's .\bin\Release\netcoreapp1.1 subdirectory. Note that each subdirectory contains the complete set of files (both your app files and all .NET Core files) needed to launch your app.

    Along with your application's files, the publishing process emits a program database (.pdb) file that contains debugging information about your app. The file is useful primarily for debugging exceptions. You can choose not to package it with your application's files. You should, however, save it in the event that you want to debug the Release build of your app.

    So the correct files to deploy are the ones in the publish subdirectory. That directory is 60+ MB because it includes the .NET core libraries needed for self-contained deployment.

提交回复
热议问题