Is there a way to make a console application run using only a single file in .NET Core?

前端 未结 3 548
悲哀的现实
悲哀的现实 2020-11-29 10:00

In .NET framework, you can make a single .EXE file that will run from the command line without having any extra config files (and if using ILMerge, you can put

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 10:51

    It is possible in .NET Core 3.0+

    The feature is enabled by the usage of the following property in your project file (.csproj):

    
        true
    
    

    There are other options as well, such as packaging the pdb into the bundle, or leaving certain files out.

    Documentation can be found here: https://docs.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained

    True it just works:

    Combine this technique with the Self Contained Deployment workflow, you can get a true "it just works" experience for your user, they don't even have to install the .NET Core runtime for your app to run.

    I am currently deploying applications to my clients as single .exe files.

    Read more about that here: https://docs.microsoft.com/en-us/dotnet/core/deploying/#self-contained-deployments-scd

提交回复
热议问题