Runs a dotnet new command
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| args | array | - | |
| template | string | - | |
| targetPath | string | - |
Output Schema
Usage Examples
Generate an ASP.NET Core Web API in a service directory
Creates a new Web API project using dotnet new webapi under a services folder. Use after fetch:template and before publishing with publish:github and registering with catalog:register.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: .
- id: generate-webapi
action: dotnet:new
input:
template: webapi
args:
- -n
- ${{ parameters.serviceId }}
- --framework
- net8.0
- --use-controllers
- --no-restore
targetPath: services/${{ parameters.serviceId }}
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}
- id: register
action: catalog:register
input:
repoContentsUrl: https://github.com/${{ parameters.owner }}/${{ parameters.repoName }}/blob/main
catalogInfoPath: /catalog-info.yamlCreate a class library project in src
Generates a reusable class library with .NET 8 under src. Run after fetch:template and then publish with publish:github.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: .
- id: generate-classlib
action: dotnet:new
input:
template: classlib
args:
- -n
- ${{ parameters.libraryName }}
- --framework
- net8.0
targetPath: src/${{ parameters.libraryName }}
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}Scaffold an xUnit test project in tests
Creates an xUnit test project for your service under tests with the chosen framework. This pairs well with an app project generated in another step.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: .
- id: generate-tests
action: dotnet:new
input:
template: xunit
args:
- -n
- ${{ parameters.serviceId }}.Tests
- --framework
- net8.0
- --no-restore
targetPath: tests/${{ parameters.serviceId }}.TestsInitialize a solution with API and shared library projects
Sets up a solution file at the repo root and creates separate API and shared library projects in src. Use fetch:template first to prepare the workspace.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: .
- id: init-solution
action: dotnet:new
input:
template: sln
args:
- -n
- ${{ parameters.repoName }}
targetPath: .
- id: generate-api
action: dotnet:new
input:
template: webapi
args:
- -n
- ${{ parameters.serviceId }}
- --framework
- net8.0
- --use-controllers
targetPath: src/${{ parameters.serviceId }}
- id: generate-shared-lib
action: dotnet:new
input:
template: classlib
args:
- -n
- ${{ parameters.serviceId }}.Contracts
- --framework
- net8.0
targetPath: src/${{ parameters.serviceId }}.ContractsGenerate a gRPC service for internal RPC
Creates a gRPC microservice with .NET 8 in a dedicated services directory. After generation, publish using publish:github and register with catalog:register.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: .
- id: generate-grpc
action: dotnet:new
input:
template: grpc
args:
- -n
- ${{ parameters.serviceId }}Grpc
- --framework
- net8.0
targetPath: services/${{ parameters.serviceId }}-grpc
- id: publish
action: publish:github
input:
repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.repoName }}
- id: register
action: catalog:register
input:
repoContentsUrl: https://github.com/${{ parameters.owner }}/${{ parameters.repoName }}/blob/main
catalogInfoPath: /catalog-info.yaml