publish (trimmed): same command, different outputs
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
I noticed that `dotnet publish` produces different outputs, depending on the order of the previous commands.
For example:
1. make a new folder (helloworld)
2. in that folder, run `dotnet new console` (it creates a 'hello world' project)
3. run `dotnet publish -c Release -r win-x64 --sc -p:PublishSingleFile=True -p:PublishTrimmed=True`
4. run `dotnet publish -c Release -r win-x64 --sc -p:PublishSingleFile=True -p:PublishTrimmed=True -p:TrimMode=CopyUsed -p:PublishReadyToRun=True`
Size of helloworld.exe: ~**16 MB** and no warnings.
5. run `dotnet publish -c Release -r win-x64 --sc -p:PublishSingleFile=True`
6. run `dotnet publish -c Release -r win-x64 --sc -p:PublishSingleFile=True -p:PublishTrimmed=True -p:TrimMode=CopyUsed -p:PublishReadyToRun=True`
Size of helloworld.exe: ~**32.5 MB** and 9 warnings.
(You get the same if you run just this last command directly on a new project.)
So the second method produces a file that is about twice as big. And if you do it without `-p:PublishSingleFile=True` you can see there are differences in the number and size of the included DLLs.
Both apps appear to work fine. But why the difference and which one is correct?
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the two `dotnet publish` command sequences from the issue in a new `helloworld` project, comparing executable sizes, warnings, and generated DLLs. Start by isolating which preceding command changes the later publish and determine which output is expected; done means the differing behavior and correct result are explained or a focused fix is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100