-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[release-notes] .NET SDK in .NET 11 RC 2 #10604
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f7e5e80
[release-notes] Draft sdk notes for .NET 11 RC 2
danroth27 f78a137
Merge updated RC2 base index
danroth27 fb0fdea
[release-notes] Link SDK in the RC2 index
danroth27 e626006
Merge refreshed RC2 base into component branch
danroth27 ddcdaad
Merge publish-ready RC2 index into component branch
danroth27 7b1662e
Merge publication-ready RC2 base index
danroth27 8c15d8a
Document SDK RC2 launch profile expansion
baronfel 866f744
Align SDK RC2 note and sample
baronfel 1417d14
Merge remote-tracking branch 'origin/release-notes/11.0-rc2' into rel…
baronfel 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
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,40 @@ | ||
| # SDK in .NET 11 RC 2 - Release Notes | ||
|
|
||
| .NET 11 RC 2 improves file-based program configuration and launch-profile arguments: | ||
|
|
||
| - [Quoted file-level directive values](#quoted-file-level-directive-values) | ||
| - [MSBuild properties in launch-profile arguments](#msbuild-properties-in-launch-profile-arguments) | ||
|
|
||
| ## Quoted file-level directive values | ||
|
|
||
| File-based programs can use quoted values containing spaces in `#:property` directives. The `#:package`, `#:project`, and `#:ref` directives also accept trailing `Name=Value` tokens for MSBuild item metadata. This example uses the `Aliases` metadata on a package directive and references the package through the resulting C# extern alias ([dotnet/sdk #55960](https://github.com/dotnet/sdk/pull/55960)). | ||
|
|
||
| ```csharp | ||
| #:property Company="RC2 Validation Team" | ||
| #:property AssemblyTitle="RC2 Directive Validation" | ||
| #:package System.CommandLine@2.0.1 Aliases=CommandLine | ||
|
|
||
| extern alias CommandLine; | ||
| using System.Reflection; | ||
|
|
||
| string? company = Assembly.GetExecutingAssembly() | ||
| .GetCustomAttribute<AssemblyCompanyAttribute>()?.Company; | ||
| var nameOption = new CommandLine::System.CommandLine.Option<string>("--name"); | ||
| var command = new CommandLine::System.CommandLine.RootCommand(); | ||
| command.Options.Add(nameOption); | ||
| string? name = command.Parse(args).GetValue(nameOption); | ||
| if (company != "RC2 Validation Team" || name != "RC2") | ||
| { | ||
| throw new Exception($"Unexpected metadata or argument: {company}, {name}."); | ||
| } | ||
|
|
||
| Console.WriteLine($"Company: {company}; name: {name}"); | ||
| ``` | ||
|
|
||
| Run the file with `dotnet run Program.cs -- --name RC2`. The quoted value becomes the generated assembly's `Company` metadata, and `System.CommandLine` parses the supplied option through the `CommandLine` alias. | ||
|
|
||
| See the [file-based apps documentation](https://learn.microsoft.com/dotnet/core/sdk/file-based-apps) for supported directives and the broader workflow. | ||
|
|
||
| ## MSBuild properties in launch-profile arguments | ||
|
|
||
| `dotnet run` now expands MSBuild properties in a launch profile's `commandLineArgs` using the evaluated project. For example, a profile argument such as `--name $(AssemblyName)` receives the project's assembly name when you run `dotnet run --launch-profile <profile>` ([dotnet/sdk #56064](https://github.com/dotnet/sdk/pull/56064)). |
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,19 @@ | ||
| #:property Company="RC2 Validation Team" | ||
| #:property AssemblyTitle="RC2 Directive Validation" | ||
| #:package System.CommandLine@2.0.1 Aliases=CommandLine | ||
|
|
||
| extern alias CommandLine; | ||
| using System.Reflection; | ||
|
|
||
| string? company = Assembly.GetExecutingAssembly() | ||
| .GetCustomAttribute<AssemblyCompanyAttribute>()?.Company; | ||
| var nameOption = new CommandLine::System.CommandLine.Option<string>("--name"); | ||
| var command = new CommandLine::System.CommandLine.RootCommand(); | ||
| command.Options.Add(nameOption); | ||
| string? name = command.Parse(args).GetValue(nameOption); | ||
| if (company != "RC2 Validation Team" || name != "RC2") | ||
| { | ||
| throw new Exception($"Unexpected metadata or argument: {company}, {name}."); | ||
| } | ||
|
|
||
| Console.WriteLine($"Company: {company}; name: {name}"); |
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,5 @@ | ||
| # SDK release-note validation | ||
|
|
||
| Run `dotnet run Program.cs -- --name RC2` from this directory with SDK `11.0.100-rc.2.26475.137`. The file-based app checks that a quoted file-level property becomes generated assembly metadata and uses `System.CommandLine` through a C# extern alias supplied by trailing `Aliases=CommandLine` package metadata. | ||
|
|
||
| To verify MSBuild property expansion in file-based launch-profile arguments, run `dotnet run --file launch-profile/Program.cs --launch-profile AssemblyName` from this directory. The adjacent `Program.run.json` defines the profile, and the file-based program declares `AssemblyName`; it exits with an error if the property is not expanded. |
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,8 @@ | ||
| #:property AssemblyName=LaunchProfileExpansion | ||
|
|
||
| if (args.Length != 1 || args[0] != "LaunchProfileExpansion") | ||
| { | ||
| throw new Exception($"Expected expanded AssemblyName argument; got '{string.Join(' ', args)}'."); | ||
| } | ||
|
|
||
| Console.WriteLine($"Expanded launch-profile argument: {args[0]}"); |
8 changes: 8 additions & 0 deletions
8
release-notes/11.0/samples/sdk/launch-profile/Program.run.json
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,8 @@ | ||
| { | ||
| "profiles": { | ||
| "AssemblyName": { | ||
| "commandName": "Project", | ||
| "commandLineArgs": "$(AssemblyName)" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.