-
Notifications
You must be signed in to change notification settings - Fork 165
Add proposal for simplified output paths (version 2) #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dsplaisted
wants to merge
10
commits into
main
Choose a base branch
from
simplify-output-paths-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0fea6f5
Add proposal for simplified output paths
dsplaisted a78334a
Apply suggestions from code review
dsplaisted 8d3d67f
Fix incomplete sentence
dsplaisted 7d2a6cd
Switch to artifacts output format
dsplaisted c1e281e
Add root artifacts path support
dsplaisted 2e06586
Updates around pack logic
dsplaisted 1ebb788
Update proposal
dsplaisted a097870
Switch to obj folder, other updates
dsplaisted e542ce5
Apply feedback
dsplaisted 134b8b0
Match normal pattern for CLI parameters
dsplaisted File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Simplify .NET Output Paths | ||
|
||
We'd like to simplify the output paths for .NET 8. | ||
|
||
Currently, the default output path for a .NET project includes folders for the `TargetFramework` and the `RuntimeIdentifier` (if it is set). Additionally, the publish output goes in a `publish` subfolder of the output folder. The resulting paths are as follows: | ||
|
||
- `bin\<Configuration>\<TargetFramework>` - Build output with no `RuntimeIdentifier` | ||
- `bin\<Configuration>\<TargetFramework>\<RuntimeIdentifier>` - Build output with `RuntimeIdentifier` | ||
- `bin\<Configuration>\<TargetFramework>\publish` - Publish output with no `RuntimeIdentifier` | ||
- `bin\<Configuration>\<TargetFramework>\<RuntimeIdentifier>\publish` - Publish output with `RuntimeIdentifier` | ||
|
||
This is rather complicated an inconsistent, which can make for a poor first impression of the .NET platform. | ||
|
||
We'd like to try to improve the output path structure. Desired qualities include: | ||
|
||
- Simple and consistent | ||
- Avoid cases where one output path is nested inside of another one | ||
- Avoid excessively deep directory heirarchies | ||
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Get rid of `obj` folder in project root | ||
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Proposed behavior | ||
|
||
Projects targeting .NET and higher will by default use a new output path format. The output path will consist of the following 3 nested folders | ||
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
- `bin` - All output (including intermediate output, will go under this folder) | ||
- Output Type - Such as `build`, `publish`, `obj`, or `packages` | ||
akoeplinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Pivots - This will at minimum be the `Configuration`, such as `Debug` or `Release`. Other pivots such as `TargetFramework` or `RuntimeIdentifier` may also be included, and the pivots will be joined by the underscore (`_`) character | ||
akoeplinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- `TargetFramework` will be included in the folder name if the project is multi-targeted (`TargetFrameworks` is non-empty), or if the `TargetFramework` property was set via the command line (ie is a global property) | ||
- `RuntimeIdentifier` will be included in the folder name if it was explicitly set (either in a project file or on the command line). If it is set automatically by the SDK (for exmaple because `SelfContained` was set) | ||
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Some examples: | ||
|
||
- `bin\build\Debug` - The build output path for a simple project when you run `dotnet build` | ||
- `bin\obj\Debug` - The intermediate output path for a simple project when you run `dotnet build` | ||
- `bin\build\Debug_net8.0` - The build output path for the `net8.0` build of a multi-targeted project | ||
- `bin\publish\Release_linux-x64` - The publish path for a simple app when publishing for `linux-x64` | ||
- `bin\package\Release` - The folder where the release .nupkg will be created for a project | ||
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Considerations | ||
|
||
### Breaking changes | ||
|
||
These changes could break things such as scripts that copy the output of the build or custom MSBuild logic that hard-codes these paths. Tieing these changes to the project TargetFramework ensures that these breaks will be encountered when the project is modified to target a new TargetFramework, not when updating to a new version of the .NET SDK. | ||
akoeplinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### Opting in or out of the new behavior | ||
|
||
We need a way to explicitly opt in to or out of the new behavior. This will let projects targeting prior versions of .NET opt in to the new folder structure, which is especially desirable for multi-targeted projects so that the inner builds have consistent output paths with each other. It will also let projects that target .NET 8 use the old output path structure, for example if the new paths break scripts or CI setup. | ||
|
||
We need to come up with a name for the property that controls this. `UseNewOutputPathFormat` is probably not a good name. | ||
akoeplinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### Can't we use `bin\Debug`? | ||
|
||
Before .NET Core, .NET Framework projects generally put their output directly in `bin\Debug` or `bin\Release`. It would be desirable if we could go back to putting the output in `bin\Debug`. However, to do so we would need to do one of the following: | ||
dsplaisted marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
- Add more top-level project output folders (for example `pub/` for publish output next to `bin/` and `obj`) | ||
- Have an inconsistent folder structure (for example `bin\publish` next to `bin\Debug`) | ||
|
||
This is a classic "pick two of three things" situation, and we believe the least important of the three was trying to preserve `bin\<Configuration>` as an output path. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.