Compile a .NET Core application as an EXE file using Visual Studio 2017

前端 未结 5 1521
不思量自难忘°
不思量自难忘° 2020-11-28 09:10

I created a .NET Core application (v1.1) in Visual Studio 2017. When I compile it, I get a DLL file produced instead of the expected EXE file for the built project. I did ch

5条回答
  •  忘掉有多难
    2020-11-28 09:28

    Starting with .NET Core 2.2 you can build framework-dependent executables


    Although building a self-contained deployment can be a good solution, it has its own drawbacks. (See R.Titov and Martin Ullrichs' answers on SCD-s.)

    Fortunately, .NET Core 2.2 supports the building of so called framework-dependent executable-s, that are essentially a wrapper binary (.exe on Windows) around the standard dll-s.

    This way you have all the advantages (and disadvantages) of the standard framework-dependent deployment (again, see Martin's answer), but you have a convenient way to launch it, without having to call it through the dotnet CLI.

    You can publish your app as a Framework-Dependent Executable using the following syntax:

    dotnet publish -c Release -r  --self-contained false
    

    Where RID is the usual runtime identifier, e.g. win-x64 or whatever platform you wish to build for (see the catalog here).

提交回复
热议问题