Skip to content

Commit cd5dc53

Browse files
committed
Update Blazor WebAssembly Template to version 3.0.0 and enhance project configuration
- Updated the package version in `Package.Template.nuspec` and related documentation to 3.0.0. - Removed the `README_NUGET.md` file as it is no longer needed. - Adjusted `.gitignore` to include new output folders and files. - Updated GitHub Actions workflows for improved build and test processes. - Refactored `launchSettings.json` and `global.json` to align with the new version and project structure. - Enhanced UI components and fixed minor issues in the template files.
1 parent ea31ea6 commit cd5dc53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1258
-70
lines changed

.azure/pipelines/ci-build_net.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# ASP.NET Core (.NET Framework)
2+
# Build and test ASP.NET Core projects targeting the full .NET Framework.
3+
# Add steps that publish symbols, save build artifacts, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
5+
6+
# Before run pipeline please check the variables
7+
# *** Library variables ***
8+
# azureSubscription (only for deploy)
9+
10+
# *** Pipeline variables ***
11+
# MajorVer
12+
# MinorVer
13+
# appServiceName (only for deploy)
14+
15+
# Changing the name the variable $(Build.BuildNumber) will change as well
16+
name: $(MajorVer).$(MinorVer)$(Rev:.r)
17+
18+
# manual trigger
19+
trigger:
20+
- none
21+
#- main
22+
#- develop
23+
24+
pool:
25+
name: Azure Pipelines
26+
vmImage: ubuntu-latest # Agent VM image name
27+
28+
resources:
29+
- repo: self
30+
31+
variables:
32+
- group: General
33+
- name: buildConfiguration
34+
value: "Release"
35+
- name: version
36+
value: "$(Build.BuildNumber)" # This variable is used to update the nuget version
37+
38+
# Single stage Build section
39+
steps:
40+
- task: UseDotNet@2
41+
displayName: "Use NET9"
42+
inputs:
43+
version: "9.0.x"
44+
includePreviewVersions: true # Required for preview versions
45+
46+
- task: NuGetAuthenticate@1
47+
displayName: "NuGet Authenticate"
48+
49+
- task: DotNetCoreCLI@2
50+
displayName: "Build projects"
51+
inputs:
52+
command: "build"
53+
projects: "**/Host.csproj"
54+
arguments: "--configuration $(BuildConfiguration)" # Update this to match your need
55+
56+
# Run the Test (after building)
57+
- task: DotNetCoreCLI@2
58+
displayName: "Run tests"
59+
inputs:
60+
command: "test"
61+
projects: "**/*Tests/*.csproj"
62+
arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura'
63+
publishTestResults: true
64+
65+
- task: PublishCodeCoverageResults@2
66+
displayName: "Publish code coverage report"
67+
inputs:
68+
codeCoverageTool: "Cobertura"
69+
summaryFileLocation: "$(Agent.TempDirectory)/**/coverage.cobertura.xml"
70+
71+
# Publish the artifact to be ready for deploy
72+
- task: DotNetCoreCLI@2
73+
displayName: Publish
74+
inputs:
75+
command: "publish"
76+
publishWebProjects: true
77+
# arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
78+
# zipAfterPublish: True
79+
80+
- task: CopyFiles@2
81+
displayName: "Copy Artifacts"
82+
inputs:
83+
targetFolder: "$(Build.ArtifactStagingDirectory)"
84+
85+
- task: PublishBuildArtifacts@1
86+
displayName: "Publish Artifacts"
87+
inputs:
88+
pathToPublish: "$(Build.ArtifactStagingDirectory)"
89+
# Deploy the artifact on Azure
90+
# Please move this step to the release pipeline
91+
#- task: AzureRmWebAppDeployment@4
92+
# displayName: 'Deploy Azure App Service'
93+
# inputs:
94+
# connectionType: 'AzureRM'
95+
# azureSubscription: '$(AzureSubscription)'
96+
# appType: 'webAppLinux'
97+
# webAppName: '$(AppServiceName)'
98+
# packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip'
99+
# runtimeStack: 'DOTNETCORE|9.0'
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Build and push a Docker image to Azure Container Registry
2+
# The stage contains a couple of build and push
3+
# One for Develop and one for Production
4+
# https://aka.ms/yaml
5+
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
6+
7+
# NOTE: Each docker image shall tag with a unique number.
8+
# That number is the value coming from 'Build.BuildId' global variable
9+
10+
# Before run pipeline please check the variables
11+
# *** Library variables ***
12+
# AcrConnectionDev: The Acr Service connection for NO-Prod enviroments
13+
# AcrConnectionProd: The Acr Service connection for PROD enviroments
14+
# PatNugetsFeed: The PAT to enable access to Private Nuget Feed
15+
16+
# *** Pipeline variables ***
17+
# MajorVer: The MajorVer Used for pipeline definition
18+
# MinorVer: The MinorVer Used for pipeline definition
19+
# RepositoryName: The name of the ACR Repository Name (To be used only for Azure Deployment)
20+
# HostFolder: The folder name where the host with Dockerfile is placed it could be (WebApi|worker)
21+
22+
# Changing the name the variable $(Build.BuildNumber) will change as well
23+
name: $(MajorVer).$(MinorVer)$(Rev:.r)
24+
25+
# manual trigger
26+
trigger:
27+
- none
28+
29+
pool:
30+
name: Azure Pipelines
31+
vmImage: ubuntu-latest # Agent VM image name
32+
33+
resources:
34+
- repo: self
35+
36+
variables:
37+
# Here is how to read the Variables from Variable group
38+
- group: "General" # The variable group Name
39+
40+
stages:
41+
- stage: BuildDev
42+
displayName: Docker Image (Dev)
43+
condition: and(always(), contains(variables['Build.SourceBranch'], 'refs/heads/develop'))
44+
jobs:
45+
- job: Build
46+
displayName: Build
47+
48+
steps:
49+
- task: Docker@2
50+
displayName: "Build Image"
51+
inputs:
52+
command: build
53+
repository: $(RepositoryName)
54+
tags: "$(Build.BuildId),latest" # Use build number as tag
55+
dockerfile: "./src/$(HostFolder)/Dockerfile"
56+
arguments: --build-arg PAT_VALUE=$(PatNugetsFeed)
57+
buildContext: "./" # Uncomment if your Dockerfile is not in the root of the repo
58+
containerRegistry: "$(AcrConnectionDev)"
59+
60+
- task: Docker@2
61+
displayName: Push Image
62+
inputs:
63+
command: push
64+
repository: $(RepositoryName)
65+
tags: "$(Build.BuildId),latest"
66+
containerRegistry: "$(AcrConnectionDev)"
67+
68+
- stage: BuildProd
69+
displayName: Docker Image (Prod)
70+
condition: and(always(), contains(variables['Build.SourceBranch'], 'refs/heads/main'))
71+
jobs:
72+
- job: Build
73+
displayName: Build
74+
75+
steps:
76+
- task: Docker@2
77+
displayName: "Build Image"
78+
inputs:
79+
command: build
80+
repository: $(RepositoryName)
81+
tags: "$(Build.BuildId),latest" # Use build number as tag
82+
dockerfile: "./src/$(HostFolder)/Dockerfile"
83+
arguments: --build-arg PAT_VALUE=$(PatNugetsFeed)
84+
buildContext: "./" # Uncomment if your Dockerfile is not in the root of the repo
85+
containerRegistry: "$(AcrConnectionProd)"
86+
87+
- task: Docker@2
88+
displayName: Push Image
89+
inputs:
90+
command: push
91+
repository: $(RepositoryName)
92+
tags: "$(Build.BuildId),latest"
93+
containerRegistry: "$(AcrConnectionProd)"
94+
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Build and push a Docker image to Docker hub
2+
# The stage contains a couple of build and push
3+
# One for the Version and one for Latest
4+
# https://aka.ms/yaml
5+
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
6+
7+
# NOTE: Each docker image shall tag with a unique number.
8+
# That number is the value coming from 'Build.BuildId' global variable
9+
10+
# Before run pipeline please check the variables
11+
# *** Library variables ***
12+
# DockerhubConnection: The Docker Hub Service connection
13+
# PatNugetsFeed: The PAT to enable access to Private Nuget Feed
14+
15+
# *** Pipeline variables ***
16+
# MajorVer: The MajorVer Used for pipeline definition
17+
# MinorVer: The MinorVer Used for pipeline definition
18+
# RepositoryName: The name of the image to be created in Docker Hub including the repository
19+
# HostFolder: The folder name where the host with Dockerfile is placed it could be (WebApi|worker)
20+
21+
# Changing the name the variable $(Build.BuildNumber) will change as well
22+
name: $(majorVer).$(minorVer)$(Rev:.r)
23+
24+
# manual trigger
25+
trigger:
26+
- none
27+
28+
pool:
29+
name: Azure Pipelines
30+
vmImage: ubuntu-latest # Agent VM image name
31+
32+
resources:
33+
- repo: self
34+
35+
variables:
36+
# Here is how to read the Variables from Variable group
37+
- group: "General" # The variable group Name
38+
39+
stages:
40+
- stage: Build
41+
displayName: Docker Image
42+
condition: and(always(), contains(variables['Build.SourceBranch'], 'refs/heads/main'))
43+
jobs:
44+
- job: Build
45+
displayName: Build
46+
47+
steps:
48+
- task: Docker@2
49+
displayName: "Build Image"
50+
inputs:
51+
command: build
52+
repository: $(RepositoryName)
53+
tags: "$(Build.BuildId),latest" # Use build number as tag
54+
dockerfile: "./src/$(HostFolder)/Dockerfile"
55+
arguments: --build-arg PAT_VALUE=$(PatNugetsFeed)
56+
buildContext: "./" # Uncomment if your Dockerfile is not in the root of the repo
57+
containerRegistry: "$(DockerhubConnection)" # The Docker Hub Service connection
58+
59+
- task: Docker@2
60+
displayName: Push Image
61+
inputs:
62+
command: push
63+
repository: $(RepositoryName)
64+
tags: "$(Build.BuildId),latest"
65+
containerRegistry: "$(DockerhubConnection)" # The Docker Hub Service connection
66+
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# ASP.NET Core (.NET Framework)
2+
# Build and test ASP.NET Core projects targeting the full .NET Framework.
3+
# Add steps that publish symbols, save build artifacts, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
5+
6+
# Before run pipeline please check the variables
7+
# *** Library variables ***
8+
# PrivateFeed - Nuget feed name or id where the package will be published
9+
10+
# *** Pipeline variables ***
11+
# MajorVer
12+
# MinorVer
13+
# ProjectName - The name of the project to be built and published on Nuget
14+
15+
# Changing the name the variable $(Build.BuildNumber) will change as well
16+
name: $(MajorVer).$(MinorVer)$(Rev:.r)
17+
18+
# manual trigger
19+
trigger:
20+
- none
21+
22+
pool:
23+
name: Azure Pipelines
24+
vmImage: ubuntu-latest # Agent VM image name
25+
26+
resources:
27+
- repo: self
28+
29+
variables:
30+
- group: General
31+
- name: buildConfiguration
32+
value: "Release"
33+
- name: version
34+
value: "$(Build.BuildNumber)" # This variable is used to update the nuget version
35+
36+
# Single stage Build section
37+
steps:
38+
- task: UseDotNet@2
39+
displayName: "Use NET9"
40+
inputs:
41+
version: "9.0.x"
42+
includePreviewVersions: true # Required for preview versions
43+
44+
- task: NuGetAuthenticate@1
45+
displayName: "NuGet Authenticate"
46+
- task: DotNetCoreCLI@2
47+
displayName: "Restore packages"
48+
inputs:
49+
command: "restore"
50+
projects: "**/*.csproj"
51+
feedsToUse: "select"
52+
vstsFeed: "$(PrivateFeed)"
53+
arguments: "--configuration $(buildConfiguration)"
54+
55+
- task: DotNetCoreCLI@2
56+
displayName: "Build projects"
57+
inputs:
58+
command: "build"
59+
projects: "**/*.csproj"
60+
arguments: "-p:MyPackVersion=$(Build.BuildNumber) --configuration $(buildConfiguration) --no-restore --nologo" # Update this to match your need
61+
62+
# Pack, publish and push to the feed
63+
- task: DotNetCoreCLI@2
64+
displayName: "Pack NuGet Package"
65+
inputs:
66+
command: "pack"
67+
packagesToPack: "**/$(ProjectName).csproj"
68+
versioningScheme: "byEnvVar"
69+
versionEnvVar: "Build.BuildNumber"
70+
71+
- task: DotNetCoreCLI@2
72+
displayName: "Publish the artifacts"
73+
inputs:
74+
command: publish
75+
publishWebProjects: True
76+
arguments: "--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)"
77+
zipAfterPublish: True
78+
79+
- task: DotNetCoreCLI@2
80+
displayName: "Push to the feed"
81+
inputs:
82+
command: "push"
83+
publishVstsFeed: "$(PrivateFeed)"

0 commit comments

Comments
 (0)