Skip to content

Commit 0a2d5df

Browse files
authored
Merge pull request #63625 from dotnet/merge/release/10.0-to-main
[automated] Merge branch 'release/10.0' => 'main'
2 parents f292245 + 8789f54 commit 0a2d5df

File tree

12 files changed

+130
-63
lines changed

12 files changed

+130
-63
lines changed

eng/common/SetupNugetSources.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ if ($dotnet31Source -ne $null) {
157157
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
158158
}
159159

160-
$dotnetVersions = @('5','6','7','8','9')
160+
$dotnetVersions = @('5','6','7','8','9','10')
161161

162162
foreach ($dotnetVersion in $dotnetVersions) {
163163
$feedPrefix = "dotnet" + $dotnetVersion;

eng/common/SetupNugetSources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ if [ "$?" == "0" ]; then
9999
PackageSources+=('dotnet3.1-internal-transport')
100100
fi
101101

102-
DotNetVersions=('5' '6' '7' '8' '9')
102+
DotNetVersions=('5' '6' '7' '8' '9' '10')
103103

104104
for DotNetVersion in ${DotNetVersions[@]} ; do
105105
FeedPrefix="dotnet${DotNetVersion}";

src/Components/Components/src/RouteView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public Task SetParametersAsync(ParameterView parameters)
6868
/// Renders the component.
6969
/// </summary>
7070
/// <param name="builder">The <see cref="RenderTreeBuilder"/>.</param>
71+
[UnconditionalSuppressMessage("Trimming", "IL2110", Justification = "Layout components are preserved because the LayoutAttribute constructor parameter is correctly annotated.")]
7172
[UnconditionalSuppressMessage("Trimming", "IL2111", Justification = "Layout components are preserved because the LayoutAttribute constructor parameter is correctly annotated.")]
7273
[UnconditionalSuppressMessage("Trimming", "IL2118", Justification = "Layout components are preserved because the LayoutAttribute constructor parameter is correctly annotated.")]
7374
protected virtual void Render(RenderTreeBuilder builder)

src/Tools/Shared/SecretsHelpers/MsBuildProjectFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public string FindMsBuildProject(string project)
4646

4747
if (!File.Exists(projectPath))
4848
{
49-
throw new FileNotFoundException(SecretsHelpersResources.FormatError_ProjectPath_NotFound(projectPath));
49+
throw new FileNotFoundException(SecretsHelpersResources.FormatError_File_NotFound(projectPath));
5050
}
5151

5252
return projectPath;

src/Tools/Shared/SecretsHelpers/ProjectIdResolver.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public string Resolve(string project, string configuration)
5959
UseShellExecute = false,
6060
ArgumentList =
6161
{
62-
"msbuild",
62+
"build",
6363
projectFile,
64-
"/nologo",
64+
"--no-restore",
6565
"/t:_ExtractUserSecretsMetadata", // defined in SecretManager.targets
6666
"/p:_UserSecretsMetadataFile=" + outputFile,
6767
"/p:Configuration=" + configuration,
@@ -72,7 +72,7 @@ public string Resolve(string project, string configuration)
7272
};
7373

7474
#if DEBUG
75-
_reporter.Verbose($"Invoking '{psi.FileName} {psi.Arguments}'");
75+
_reporter.Verbose($"Invoking '{psi.FileName} {string.Join(' ', psi.ArgumentList)}'");
7676
#endif
7777

7878
using var process = new Process()

src/Tools/Shared/SecretsHelpers/SecretsHelpersResources.resx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@
124124
<value>Multiple MSBuild project files found in '{projectPath}'. Specify which to use with the --project option.</value>
125125
</data>
126126
<data name="Error_NoProjectsFound" xml:space="preserve">
127-
<value>Could not find a MSBuild project file in '{projectPath}'. Specify which project to use with the --project option.</value>
127+
<value>Could not find a MSBuild project file in '{projectPath}'. Specify which project to use with the --project option. Use --file option for file-based apps.</value>
128128
</data>
129129
<data name="Error_ProjectFailedToLoad" xml:space="preserve">
130130
<value>Could not load the MSBuild project '{project}'.</value>
131131
</data>
132132
<data name="Error_ProjectMissingId" xml:space="preserve">
133133
<value>Could not find the global property 'UserSecretsId' in MSBuild project '{project}'. Ensure this property is set in the project or use the '--id' command line option.</value>
134134
</data>
135-
<data name="Error_ProjectPath_NotFound" xml:space="preserve">
136-
<value>The project file '{0}' does not exist.</value>
135+
<data name="Error_File_NotFound" xml:space="preserve">
136+
<value>The file '{0}' does not exist.</value>
137137
</data>
138138
<data name="Message_ProjectAlreadyInitialized" xml:space="preserve">
139139
<value>The MSBuild project '{project}' has already been initialized with a UserSecretsId.</value>
@@ -144,4 +144,4 @@
144144
<data name="Message_SetUserSecretsIdForProject" xml:space="preserve">
145145
<value>Set UserSecretsId to '{userSecretsId}' for MSBuild project '{project}'.</value>
146146
</data>
147-
</root>
147+
</root>

src/Tools/dotnet-user-secrets/src/CommandLineOptions.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class CommandLineOptions
1616
public bool IsHelp { get; private set; }
1717
public bool IsVerbose { get; private set; }
1818
public string Project { get; private set; }
19+
public string File { get; private set; }
1920

2021
public static CommandLineOptions Parse(string[] args, IConsole console)
2122
{
@@ -36,6 +37,9 @@ public static CommandLineOptions Parse(string[] args, IConsole console)
3637
var optionProject = app.Option("-p|--project <PROJECT>", "Path to project. Defaults to searching the current directory.",
3738
CommandOptionType.SingleValue, inherited: true);
3839

40+
var optionFile = app.Option("-f|--file <FILE>", "Path to file-based app.",
41+
CommandOptionType.SingleValue, inherited: true);
42+
3943
var optionConfig = app.Option("-c|--configuration <CONFIGURATION>", "The project configuration to use. Defaults to 'Debug'.",
4044
CommandOptionType.SingleValue, inherited: true);
4145

@@ -50,7 +54,7 @@ public static CommandLineOptions Parse(string[] args, IConsole console)
5054
app.Command("remove", c => RemoveCommand.Configure(c, options));
5155
app.Command("list", c => ListCommand.Configure(c, options));
5256
app.Command("clear", c => ClearCommand.Configure(c, options));
53-
app.Command("init", c => InitCommandFactory.Configure(c, options));
57+
app.Command("init", c => InitCommandFactory.Configure(c, options, optionFile));
5458

5559
// Show help information if no subcommand/option was specified.
5660
app.OnExecute(() => app.ShowHelp());
@@ -66,6 +70,12 @@ public static CommandLineOptions Parse(string[] args, IConsole console)
6670
options.IsHelp = app.IsShowingInformation;
6771
options.IsVerbose = optionVerbose.HasValue();
6872
options.Project = optionProject.Value();
73+
options.File = optionFile.Value();
74+
75+
if (options.File != null && options.Project != null)
76+
{
77+
throw new CommandParsingException(app, Resources.Error_ProjectAndFileOptions);
78+
}
6979

7080
return options;
7181
}

src/Tools/dotnet-user-secrets/src/Internal/InitCommand.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ public class InitCommandFactory : ICommand
1616
{
1717
public CommandLineOptions Options { get; }
1818

19-
internal static void Configure(CommandLineApplication command, CommandLineOptions options)
19+
internal static void Configure(CommandLineApplication command, CommandLineOptions options, CommandOption optionFile)
2020
{
2121
command.Description = "Set a user secrets ID to enable secret storage";
2222
command.HelpOption();
2323

2424
command.OnExecute(() =>
2525
{
26+
if (optionFile.HasValue())
27+
{
28+
throw new CommandParsingException(command, Resources.Error_InitNotSupportedForFileBasedApps);
29+
}
30+
2631
options.Command = new InitCommandFactory(options);
2732
});
2833
}

src/Tools/dotnet-user-secrets/src/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ internal string ResolveId(CommandLineOptions options, IReporter reporter)
106106
}
107107

108108
var resolver = new ProjectIdResolver(reporter, _workingDirectory);
109-
return resolver.Resolve(options.Project, options.Configuration);
109+
return resolver.Resolve(options.Project ?? options.File, options.Configuration);
110110
}
111111
}

src/Tools/dotnet-user-secrets/src/Resources.resx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -133,15 +133,9 @@ Use the '--help' flag to see info.</value>
133133
<data name="Error_No_Secrets_Found" xml:space="preserve">
134134
<value>No secrets configured for this application.</value>
135135
</data>
136-
<data name="Error_NoProjectsFound" xml:space="preserve">
137-
<value>Could not find a MSBuild project file in '{projectPath}'. Specify which project to use with the --project option.</value>
138-
</data>
139136
<data name="Error_ProjectMissingId" xml:space="preserve">
140137
<value>Could not find the global property 'UserSecretsId' in MSBuild project '{project}'. Ensure this property is set in the project or use the '--id' command line option.</value>
141138
</data>
142-
<data name="Error_ProjectPath_NotFound" xml:space="preserve">
143-
<value>The project file '{path}' does not exist.</value>
144-
</data>
145139
<data name="Error_ProjectFailedToLoad" xml:space="preserve">
146140
<value>Could not load the MSBuild project '{project}'.</value>
147141
</data>
@@ -169,4 +163,10 @@ Use the '--help' flag to see info.</value>
169163
<data name="Message_SetUserSecretsIdForProject" xml:space="preserve">
170164
<value>Set UserSecretsId to '{userSecretsId}' for MSBuild project '{project}'.</value>
171165
</data>
172-
</root>
166+
<data name="Error_ProjectAndFileOptions" xml:space="preserve">
167+
<value>Cannot use both --file and --project options together.</value>
168+
</data>
169+
<data name="Error_InitNotSupportedForFileBasedApps" xml:space="preserve">
170+
<value>Init command is currently not supported for file-based apps. Please add '#:property UserSecretsId=...' manually.</value>
171+
</data>
172+
</root>

0 commit comments

Comments
 (0)