Publish single exe file for win form application

741 views Asked by At

I tried this command:

dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:IncludeNativeLibrariesForSelfExtract=true --output "C:\Users\Admin\Desktop\Test_zone\TestCompile"

But it outputs:

Nothing to do. None of projects specified contain packages to restore

  • This application has been running/built normally
  • This is Visual Studio 2019 Community
  • This is .NET, not .NET Core
  • I have added ClickOnce publish installed
  • I added into the project.csproj:
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <PublishSingleFile>true</PublishSingleFile>
        <SelfContained>true</SelfContained>
        <RuntimeIdentifier>win-x64</RuntimeIdentifier>
        <PublishReadyToRun>true</PublishReadyToRun>
    </PropertyGroup>
    

I am out of ideas. I have read much about publishing single files but it all seems that there is something very simple that I missed.

0

There are 0 answers