1

发布是通过 docker 完成的。

DockerFile

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build

// restore
...

// build
..

// publish
RUN dotnet publish --no-build -c Release /p:PublishSingleFile=true -r win-x64 --self-contained true -o C:/dist

.csproj

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWPF>true</UseWPF>
    <ApplicationIcon>Common\Images\favicon.ico</ApplicationIcon>
    <StartupObject>Dtail.Platform.Launcher.App.App</StartupObject>
  </PropertyGroup>

   ...

</Project>

预期行为:

由于OutputType设置为WinExe,它应该隐藏控制台主机(

实际行为:

应用程序与控制台窗口一起打开

4

0 回答 0