How to run .NET Core console app from the command line

前端 未结 7 868
-上瘾入骨i
-上瘾入骨i 2020-12-07 09:30

I have a .NET Core console app and have run dotnet publish. However, I can\'t figure out how to run the application from the command line. Any hints?

7条回答
  •  伪装坚强ぢ
    2020-12-07 10:09

    You can very easily create an EXE (for Windows) without using any cryptic build commands. You can do it right in Visual Studio.

    1. Right click the Console App Project and select Publish.
    2. A new page will open up (screen shot below)
    3. Hit Configure...
    4. Then change Deployment Mode to Self-contained or Framework dependent. .NET Core 3.0 introduces a Single file deployment which is a single executable.
    5. Use "framework dependent" if you know the target machine has a .NET Core runtime as it will produce fewer files to install.
    6. If you now view the bin folder in explorer, you will find the .exe file.
    7. You will have to deploy the exe along with any supporting config and dll files.

提交回复
热议问题