Programs generated by .Net Core and Framework. .Net Core needs to be applied in the running environment. Sending it directly to others will cause an error.

1
2
3
4
5
6
7
8
:\Program Files (x86)\***>.\copyfiles.exe
A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Program Files (x86)\BiMass\].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].

The .NET runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=win10-x64&apphost_version=6.0.5

Reference Link

.net core publish single exe file, and optimize to reduce size

  1. Run build
    dotnet build
  2. Create package based on x64 system
    dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true
    At this time, a win-x64 file will be generated. There is a publish folder inside. The files inside can self-run and be used by others.
    Image Description
    Image Description
    Image Description