dotnet publish ProjectName.csproj --self-contained:true --runtime:win10-x64 /nologo /p:PublishProfile=Release /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /maxcpucount:1 /p:platform="Any CPU" /p:configuration="Release" /p:DesktopBuildPackageLocation="$\project.zip"
--runtimeIdentifier: it is necessary. Also, you need to specify the supported runtime identifier in your poject file.
(https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)
Commands
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore21
--runtimeIdentifier: it is necessary. Also, you need to specify the supported runtime identifier in your poject file.
(https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)
Commands
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore21