Skip to content
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

[Templates] Fix template scripts, make them more flexible and robust #57841

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

javiercn
Copy link
Member

Provides an updated Test-Templates module with a new Test-Template function to create a given template and replaces the old Test-Templates.ps1 script, which has been left there for other template scripts.

The new command allows passing parameters to the templates instead of hardcoding them into the wrapping scripts and the wrapping commands expose specific parameters for the templates they instantiate.

Other wrapping scripts have been left untouched.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Sep 12, 2024
Comment on lines +6 to +20
param(
[Parameter(Mandatory = $false, Position = 0)]
[ValidateSet("net9.0", "net10.0")]
[string] $Framework = "net9.0",
[Parameter(Mandatory = $false)]
[switch] $ExcludeLaunchSettings,
[Parameter(Mandatory = $false)]
[ValidateSet("None", "Individual")]
[string] $Auth = "None",
[Parameter(Mandatory = $false)]
[switch] $UseLocalDb,
[Parameter(Mandatory = $false)]
[switch] $NoHttps,
[Parameter(Mandatory = $false)]
[switch] $UseProgramMain,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, I asked copilot to generate this, as well as the code that maps it into the variable by giving the output from dotnet new <<template>> -h. In case someone wants to update other scripts in the future.

Copy link

@WontonSam WontonSam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good

@WontonSam
Copy link

Provides an updated Test-Templates module with a new Test-Template function to create a given template and replaces the old Test-Templates.ps1 script, which has been left there for other template scripts.

The new command allows passing parameters to the templates instead of hardcoding them into the wrapping scripts and the wrapping commands expose specific parameters for the templates they instantiate.

Other wrapping scripts have been left untouched.

@javiercn javiercn force-pushed the javiercn/fix-template-test-scripts branch from 1034a87 to a315d25 Compare September 13, 2024 18:45
@javiercn javiercn merged commit d05f358 into main Sep 18, 2024
27 checks passed
@javiercn javiercn deleted the javiercn/fix-template-test-scripts branch September 18, 2024 07:58
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview1 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants