dotnet publish --no-build doesn't preserve build output
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When you build a .NET 10.0 Windows project and digitally sign output apphost executable using your code signing certificate subsequent `dotnet publish --no-build ...` replaces signed executable with a generic unsigned executable.
Maybe I am assuming too much, but to me `--no-build` implies **DO NOT CHANGE/REGENERATE ANY BUILT FILES**.
### To Reproduce
1. Create a simple .NET 10.0 Windows GUI or Console app
2. Add a target to your .csproj which uses your preferred method to certificate-sign the output executable
3. Build the project from Visual Studio 2026
4. Since the Publish to Folder from Visual Studio 2026 is still broken run `dotnet publish --no-build ...` for the configuration / platform you just built
5. Inspect the output folder and note that executable there is no longer digitally signed
### Exceptions (if any)
N/A
### Further technical details
details of dotnet --info
.NET SDK:
Version: 10.0.101
Commit: fad253f51b
Workload version: 10.0.100-manifests.9f71effe
MSBuild version: 18.0.6+fad253f51
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.101\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.1
Architecture: x64
Commit: fad253f51b
.NET SDKs installed:
10.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [1]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
VS 2026 18.1.0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.