防止.NET Core 3.0 默认构建EXE 文件
Prevent .NET Core 3.0 from building an EXE file by default
在 .NET Core 3.0 中,构建过程中添加了一个小功能。据微软称:
.NET Core now builds framework-dependent executables by default. This behavior is new for applications that use a globally installed version of .NET Core.
我已经搜索过了,但找不到防止这种情况发生的方法。不幸的是,在将我的应用程序推送到 Cloud Foundry 时,这个可执行文件导致我出现问题,因为它现在认为它是一个独立的 EXE 文件,而它应该 运行 使用为我的应用程序构建的 DLL 文件的 dotnet cli。
有没有办法阻止构建此默认 EXE?
我总是可以在我的构建过程中添加最后一步来删除它,但似乎首先应该有一种方法来阻止它。
@PeterHuene 和@vcsjones 在上面的评论中完美地回答了这个问题:
The UseAppHost
property can be set to false (e.g. /p:UseAppHost=false
on the command line) and that will disable the creation of the executable.
- Peter Huene 19 年 10 月 21 日在 18:21
或
As an alternative to a command line change, you can also set <UseAppHost>false</UseAppHost>
in the .csproj's <PropertyGroup>
as well.
- vcsjones 19 年 10 月 21 日在 18:25
在 .NET Core 3.0 中,构建过程中添加了一个小功能。据微软称:
.NET Core now builds framework-dependent executables by default. This behavior is new for applications that use a globally installed version of .NET Core.
我已经搜索过了,但找不到防止这种情况发生的方法。不幸的是,在将我的应用程序推送到 Cloud Foundry 时,这个可执行文件导致我出现问题,因为它现在认为它是一个独立的 EXE 文件,而它应该 运行 使用为我的应用程序构建的 DLL 文件的 dotnet cli。
有没有办法阻止构建此默认 EXE?
我总是可以在我的构建过程中添加最后一步来删除它,但似乎首先应该有一种方法来阻止它。
@PeterHuene 和@vcsjones 在上面的评论中完美地回答了这个问题:
The
UseAppHost
property can be set to false (e.g./p:UseAppHost=false
on the command line) and that will disable the creation of the executable.
- Peter Huene 19 年 10 月 21 日在 18:21
或
As an alternative to a command line change, you can also set
<UseAppHost>false</UseAppHost>
in the .csproj's<PropertyGroup>
as well.
- vcsjones 19 年 10 月 21 日在 18:25