The executable file is too large after build
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
I use `dotnet publish` with `SelfContained=false` and `PublishSingleFile=true` options and noticed that when I update to `.net10` the file size after build is very large compared to `.net9`
### Reproduction Steps
I use this bat command to build
```
@echo off
setlocal enabledelayedexpansion
echo ================================
echo Building TrackingRTF Project
echo ================================
set OUTPUT_DIR=.\publish
REM Danh sách các project cần build (thêm project mới vào đây)
set PROJECTS=TrackingRTF TrackingRTF.FoCRTL TrackingRTF.Tray TrackingRTF.Core
REM Tạo thư mục output nếu chưa có
if not exist "%OUTPUT_DIR%" (
mkdir "%OUTPUT_DIR%"
)
REM Xóa các file exe cũ
echo Cleaning old executables...
for %%P in (%PROJECTS%) do (
if exist "%OUTPUT_DIR%\%%P.exe" (
echo Removing old exe: %%P.exe
del /q "%OUTPUT_DIR%\%%P.exe"
)
)
REM Build từng project
echo.
echo Starting build process...
echo.
for %%P in (%PROJECTS%) do (
echo [%%P] Building...
dotnet publish .\%%P\%%P.csproj -c Release -r win-x64 --self-contained false ^
/p:PublishSingleFile=true ^
/p:IncludeAllContentForSelfExtract=true ^
/p:DebugType=None ^
/p:DebugSymbols=false ^
-o "%OUTPUT_DIR%"
if !errorlevel! neq 0 (
echo [%%P] Build FAILED!
pause
exit /b !errorlevel!
)
echo [%%P] Build successful!
echo.
)
echo ================================
echo All builds completed!
echo Output: %OUTPUT_DIR%
echo ================================
pause
```
### Expected behavior
I wish when building with `dotnet publish` the file size would be improved similar to `.net9`. Here is a picture to prove it
### Actual behavior
this is after i upgraded to `.net10`
### Regression?
This issue does not occur in `.net9` and lower versions
### Known Workarounds
My current solution is to downgrade to `.net9`
### Impact
_No response_
### Configuration
- Net 10
- Windows 11 | Version 25H2 (OS Build 26200.7171)
- x64
- I'm not sure
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.