From bf46234575214b6949d7329736a274449bf6de14 Mon Sep 17 00:00:00 2001 From: Jason Zhai Date: Wed, 11 Dec 2024 23:25:30 -0800 Subject: [PATCH] Add support for .NET 9.0 web project templates --- ...ProjectsTests.CanShowHelp_Mvc.verified.txt | 3 +- ...jectsTests.CanShowHelp_WebAPI.verified.txt | 143 +++++++++--------- ...sts.CanShowHelp_Webapp_common.verified.txt | 3 +- test/dotnet-new.Tests/WebProjectsTests.cs | 5 + 4 files changed, 81 insertions(+), 73 deletions(-) diff --git a/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt b/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt index 52a210b737db..484502dcd3bd 100644 --- a/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt +++ b/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt @@ -68,9 +68,10 @@ Template options: -uld, --use-local-db Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified. Type: bool Default: false - -f, --framework The target framework for the project. + -f, --framework The target framework for the project. Type: choice net10.0 Target net10.0 + net9.0 Target net9.0 net8.0 Target net8.0 net7.0 Target net7.0 net6.0 Target net6.0 diff --git a/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt b/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt index b5fa37a85f90..15840d90da36 100644 --- a/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt +++ b/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt @@ -16,77 +16,78 @@ Options: --type Specifies the template type to instantiate. Template options: - -au, --auth The type of authentication to use - Type: choice - None No authentication - IndividualB2C Individual authentication with Azure AD B2C - SingleOrg Organizational authentication for a single tenant - Windows Windows authentication - Default: None - --aad-b2c-instance The Azure Active Directory B2C instance to connect to (use with IndividualB2C auth). - Type: string - Default: https://qualified.domain.name.b2clogin.com/ - -ssp, --susi-policy-id The sign-in and sign-up policy ID for this project (use with IndividualB2C auth). - Type: string - Default: b2c_1_susi - --aad-instance The Azure Active Directory instance to connect to (use with SingleOrg auth). - Type: string - Default: https://login.microsoftonline.com/ - --client-id The Client ID for this project (use with SingleOrg or IndividualB2C auth). - Type: string - Default: 11111111-1111-1111-11111111111111111 - --domain The domain for the directory tenant (use with SingleOrg or IndividualB2C auth). - Type: string - Default: qualified.domain.name - --default-scope The API scope the client needs to request to provision an access token. (use with IndividualB2C, SingleOrg). - Type: string - Default: access_as_user - --tenant-id The TenantId ID of the directory to connect to (use with SingleOrg auth). - Type: string - Default: 22222222-2222-2222-2222-222222222222 - -r, --org-read-access Whether or not to allow this application read access to the directory (only applies to SingleOrg auth). - Type: bool - Default: false - --exclude-launch-settings Whether to exclude launchSettings.json in the generated template. - Type: bool - Default: false - --no-https Whether to turn off HTTPS. This option only applies if IndividualB2C, SingleOrg, or MultiOrg aren't used for --auth. - Type: bool - Default: false - -uld, --use-local-db Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified. - Type: bool - Default: false - -f, --framework The target framework for the project. - Type: choice - net10.0 Target net10.0 - net8.0 Target net8.0 - net7.0 Target net7.0 - net6.0 Target net6.0 - Default: net10.0 - --no-restore If specified, skips the automatic restore of the project on create. - Type: bool - Default: false - --called-api-url URL of the API to call from the web app. This option only applies if --auth SingleOrg or --auth IndividualB2C is specified. - Type: string - Default: https://graph.microsoft.com/v1.0 - --calls-graph Specifies if the web app calls Microsoft Graph. This option only applies if --auth SingleOrg is specified. - Type: bool - Default: false - --called-api-scopes Scopes to request to call the API from the web app. This option only applies if --auth SingleOrg or --auth IndividualB2C is specified. - Type: string - Default: user.read - --no-openapi Disable OpenAPI (Swagger) support - Type: bool - Default: false - --use-program-main Whether to generate an explicit Program class and Main method instead of top-level statements. - Type: bool - Default: false - -controllers, --use-controllers Whether to use controllers instead of minimal APIs. This option overides the value specified by --minimal. - Type: bool - Default: false - -minimal, --use-minimal-apis Whether to use minimal APIs instead of controllers. - Type: bool - Default: false + -au, --auth The type of authentication to use + Type: choice + None No authentication + IndividualB2C Individual authentication with Azure AD B2C + SingleOrg Organizational authentication for a single tenant + Windows Windows authentication + Default: None + --aad-b2c-instance The Azure Active Directory B2C instance to connect to (use with IndividualB2C auth). + Type: string + Default: https://qualified.domain.name.b2clogin.com/ + -ssp, --susi-policy-id The sign-in and sign-up policy ID for this project (use with IndividualB2C auth). + Type: string + Default: b2c_1_susi + --aad-instance The Azure Active Directory instance to connect to (use with SingleOrg auth). + Type: string + Default: https://login.microsoftonline.com/ + --client-id The Client ID for this project (use with SingleOrg or IndividualB2C auth). + Type: string + Default: 11111111-1111-1111-11111111111111111 + --domain The domain for the directory tenant (use with SingleOrg or IndividualB2C auth). + Type: string + Default: qualified.domain.name + --default-scope The API scope the client needs to request to provision an access token. (use with IndividualB2C, SingleOrg). + Type: string + Default: access_as_user + --tenant-id The TenantId ID of the directory to connect to (use with SingleOrg auth). + Type: string + Default: 22222222-2222-2222-2222-222222222222 + -r, --org-read-access Whether or not to allow this application read access to the directory (only applies to SingleOrg auth). + Type: bool + Default: false + --exclude-launch-settings Whether to exclude launchSettings.json in the generated template. + Type: bool + Default: false + --no-https Whether to turn off HTTPS. This option only applies if IndividualB2C, SingleOrg, or MultiOrg aren't used for --auth. + Type: bool + Default: false + -uld, --use-local-db Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified. + Type: bool + Default: false + -f, --framework The target framework for the project. + Type: choice + net10.0 Target net10.0 + net9.0 Target net9.0 + net8.0 Target net8.0 + net7.0 Target net7.0 + net6.0 Target net6.0 + Default: net10.0 + --no-restore If specified, skips the automatic restore of the project on create. + Type: bool + Default: false + --called-api-url URL of the API to call from the web app. This option only applies if --auth SingleOrg or --auth IndividualB2C is specified. + Type: string + Default: https://graph.microsoft.com/v1.0 + --calls-graph Specifies if the web app calls Microsoft Graph. This option only applies if --auth SingleOrg is specified. + Type: bool + Default: false + --called-api-scopes Scopes to request to call the API from the web app. This option only applies if --auth SingleOrg or --auth IndividualB2C is specified. + Type: string + Default: user.read + --no-openapi Disable OpenAPI (Swagger) support + Type: bool + Default: false + --use-program-main Whether to generate an explicit Program class and Main method instead of top-level statements. + Type: bool + Default: false + -controllers, --use-controllers Whether to use controllers instead of minimal APIs. This option overides the value specified by --minimal. + Type: bool + Default: false + -minimal, --use-minimal-apis Whether to use minimal APIs instead of controllers. + Type: bool + Default: false To see help for other template languages (F#), use --language option: dotnet new webapi -h --language F# \ No newline at end of file diff --git a/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt b/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt index c272311e7ba8..aebfecade450 100644 --- a/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt +++ b/test/dotnet-new.Tests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt @@ -72,9 +72,10 @@ Template options: -uld, --use-local-db Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified. Type: bool Default: false - -f, --framework The target framework for the project. + -f, --framework The target framework for the project. Type: choice net10.0 Target net10.0 + net9.0 Target net9.0 net8.0 Target net8.0 net7.0 Target net7.0 net6.0 Target net6.0 diff --git a/test/dotnet-new.Tests/WebProjectsTests.cs b/test/dotnet-new.Tests/WebProjectsTests.cs index 73bdee141dcb..7cd274107a21 100644 --- a/test/dotnet-new.Tests/WebProjectsTests.cs +++ b/test/dotnet-new.Tests/WebProjectsTests.cs @@ -33,6 +33,10 @@ public WebProjectsTests(WebProjectsFixture fixture, ITestOutputHelper log) : bas [InlineData("mvc_cs-80", "mvc", "-f", "net8.0")] [InlineData("mvc_fs-80", "mvc", "-lang", "F#", "-f", "net8.0")] [InlineData("api_cs-80", "webapi", "-f", "net8.0")] + [InlineData("emptyweb_cs-90", "web", "-f", "net9.0")] + [InlineData("mvc_cs-90", "mvc", "-f", "net9.0")] + [InlineData("mvc_fs-90", "mvc", "-lang", "F#", "-f", "net9.0")] + [InlineData("api_cs-90", "webapi", "-f", "net9.0")] public void AllWebProjectsRestoreAndBuild(string testName, params string[] args) { string workingDir = Path.Combine(_fixture.BaseWorkingDirectory, testName); @@ -133,6 +137,7 @@ public WebProjectsFixture(IMessageSink messageSink) : base(messageSink) InstallPackage(TemplatePackagesPaths.MicrosoftDotNetWebProjectTemplates60Path, BaseWorkingDirectory); InstallPackage(TemplatePackagesPaths.MicrosoftDotNetWebProjectTemplates70Path, BaseWorkingDirectory); InstallPackage(TemplatePackagesPaths.MicrosoftDotNetWebProjectTemplates80Path, BaseWorkingDirectory); + InstallPackage(TemplatePackagesPaths.MicrosoftDotNetWebProjectTemplates90Path, BaseWorkingDirectory); } internal string BaseWorkingDirectory { get; private set; }