0

I need to publish single file application. Technology: winforms (.NET 6) When I'm using this command:

dotnet publish "C:\sample.csproj" -r win-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true

everything works fine, it generates pdb files and exe - and this exe works standalone. But, when I want to add

-c Release 

(since I need to publish it in release) it generates a whole bunch of files, dlls, etc. and of course exe wont work alone. Is there any solution for that?

My csproj configuration:

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <EnableWindowsTargeting>true</EnableWindowsTargeting>
    <UseWindowsForms>true</UseWindowsForms>
    <PublishSingleFile>true</PublishSingleFile>
    <_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
    <PublishReadyToRun>true</PublishReadyToRun>
    <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
  </PropertyGroup>

I cannot find any solution for that, since there are no additional parameters related to release

guidempty
  • 1
  • 2

0 Answers0