Skip to content

Commit 4be0903

Browse files
committed
feat(add version to file): and consume it with library
1 parent 4ed7e52 commit 4be0903

File tree

15 files changed

+420
-35
lines changed

15 files changed

+420
-35
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.14" PrivateAssets="all" />
1414
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.14" />
1515
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.14" />
16+
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
1617
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
1718
<PackageVersion Include="AutoMapper" Version="1.1.0.118" />
1819
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
namespace Package.BlazorComponentLibrary.BCLVersion { public static class VersionInfo { public static string Version = "3.0.5" ;
2+
} }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Microsoft.Extensions.DependencyInjection;
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Linq;
11+
using System.Text;
12+
using System.Threading.Tasks;
13+
using static System.Net.Mime.MediaTypeNames;
14+
15+
namespace Package.BlazorComponentLibrary.DependencyInjection
16+
{
17+
public static class DependencyInjection
18+
{
19+
20+
public static IServiceCollection BLC_Services(this IServiceCollection services)
21+
{
22+
23+
return services;
24+
}
25+
}
26+
}
27+
28+
29+

Package.BlazorComponentLibrary/Package.BlazorComponentLibrary.csproj

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@
99
<Nullable>enable</Nullable>
1010
<ImplicitUsings>enable</ImplicitUsings>
1111

12-
<EnableDefaultEmbeddedResources>true</EnableDefaultEmbeddedResources>
13-
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
14-
15-
16-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
17-
<PackageId>TELBlazorComponentLibrary.GitPageBlazorWasm</PackageId>
18-
<Version>$(BCLVersion)</Version>
19-
<Authors>TEL</Authors>
20-
<Company>NHS</Company>
21-
<Description>WCAG Progressive Enhancement Blazor Component Library</Description>
22-
<PackageTags>NHS, TEL, blazor, components, library</PackageTags>
23-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
24-
<RepositoryUrl>https://github.com/TechnologyEnhancedLearning/GitPageBlazorWASM</RepositoryUrl>
25-
<RepositoryType>git</RepositoryType>
26-
<PackageReadmeFile>README.md</PackageReadmeFile>
27-
<PackageOutputPath>$(NupkgOutputPath)</PackageOutputPath>
12+
13+
<EnableDefaultEmbeddedResources>true</EnableDefaultEmbeddedResources>
14+
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
15+
16+
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
18+
<PackageId>TELBlazorComponentLibrary.GitPageBlazorWasm</PackageId>
19+
<Version>$(BCLVersion)</Version>
20+
<Authors>TEL</Authors>
21+
<Company>NHS</Company>
22+
<Description>WCAG Progressive Enhancement Blazor Component Library</Description>
23+
<PackageTags>NHS, TEL, blazor, components, library</PackageTags>
24+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
25+
<RepositoryUrl>https://github.com/TechnologyEnhancedLearning/GitPageBlazorWASM</RepositoryUrl>
26+
<RepositoryType>git</RepositoryType>
27+
<PackageReadmeFile>README.md</PackageReadmeFile>
28+
<PackageOutputPath>$(NupkgOutputPath)</PackageOutputPath>
2829

2930
</PropertyGroup>
3031
<!--<Target Name="DebugProperties" BeforeTargets="Build">
@@ -39,10 +40,15 @@
3940

4041
<ItemGroup>
4142
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
43+
<PackageReference Include="Microsoft.Extensions.Http" />
4244
</ItemGroup>
4345
<ItemGroup>
4446
<Content Remove="packages.lock.json" />
4547
</ItemGroup>
4648

47-
49+
<Target Name="WriteBclVersionToFile" AfterTargets="Build">
50+
<WriteLinesToFile File="wwwroot/bclversion.txt" Lines="$(BCLVersion)" Overwrite="true" Encoding="UTF-8" />
51+
<WriteLinesToFile File="BCLVersion/VersionInfo.cs" Lines="namespace Package.BlazorComponentLibrary.BCLVersion { public static class VersionInfo { public static string Version = &quot;$(BCLVersion)&quot; %3B; } }" Overwrite="true" Encoding="UTF-8" />
52+
</Target>
53+
4854
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
@using Microsoft.AspNetCore.Components.Web
2+
@using Package.BlazorComponentLibrary.BCLVersion
3+
@using Package.BlazorComponentLibrary.Components
4+
5+

Package.BlazorComponentLibrary/packages.lock.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
"System.IO.Pipelines": "8.0.0"
1717
}
1818
},
19+
"Microsoft.Extensions.Http": {
20+
"type": "Direct",
21+
"requested": "[8.0.0, )",
22+
"resolved": "8.0.0",
23+
"contentHash": "cWz4caHwvx0emoYe7NkHPxII/KkTI8R/LC9qdqJqnKv2poTJ4e2qqPGQqvRoQ5kaSA4FU5IV3qFAuLuOhoqULQ==",
24+
"dependencies": {
25+
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
26+
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
27+
"Microsoft.Extensions.Diagnostics": "8.0.0",
28+
"Microsoft.Extensions.Logging": "8.0.0",
29+
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
30+
"Microsoft.Extensions.Options": "8.0.0"
31+
}
32+
},
1933
"Microsoft.AspNetCore.Authorization": {
2034
"type": "Transitive",
2135
"resolved": "8.0.14",
@@ -53,6 +67,31 @@
5367
"resolved": "8.0.14",
5468
"contentHash": "4dkb/7GoyaFtEggCEHStc/t05nKgnEr1QUJIP8QaDvxdZTXk9SebVeMMPBSR4zbj6dK2tUwBAOdHLA215lmOWg=="
5569
},
70+
"Microsoft.Extensions.Configuration": {
71+
"type": "Transitive",
72+
"resolved": "8.0.0",
73+
"contentHash": "0J/9YNXTMWSZP2p2+nvl8p71zpSwokZXZuJW+VjdErkegAnFdO1XlqtA62SJtgVYHdKu3uPxJHcMR/r35HwFBA==",
74+
"dependencies": {
75+
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
76+
"Microsoft.Extensions.Primitives": "8.0.0"
77+
}
78+
},
79+
"Microsoft.Extensions.Configuration.Abstractions": {
80+
"type": "Transitive",
81+
"resolved": "8.0.0",
82+
"contentHash": "3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==",
83+
"dependencies": {
84+
"Microsoft.Extensions.Primitives": "8.0.0"
85+
}
86+
},
87+
"Microsoft.Extensions.Configuration.Binder": {
88+
"type": "Transitive",
89+
"resolved": "8.0.0",
90+
"contentHash": "mBMoXLsr5s1y2zOHWmKsE9veDcx8h1x/c3rz4baEdQKTeDcmQAPNbB54Pi/lhFO3K431eEq6PFbMgLaa6PHFfA==",
91+
"dependencies": {
92+
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0"
93+
}
94+
},
5695
"Microsoft.Extensions.DependencyInjection": {
5796
"type": "Transitive",
5897
"resolved": "8.0.1",
@@ -66,6 +105,36 @@
66105
"resolved": "8.0.2",
67106
"contentHash": "3iE7UF7MQkCv1cxzCahz+Y/guQbTqieyxyaWKhrRO91itI9cOKO76OHeQDahqG4MmW5umr3CcCvGmK92lWNlbg=="
68107
},
108+
"Microsoft.Extensions.Diagnostics": {
109+
"type": "Transitive",
110+
"resolved": "8.0.0",
111+
"contentHash": "3PZp/YSkIXrF7QK7PfC1bkyRYwqOHpWFad8Qx+4wkuumAeXo1NHaxpS9LboNA9OvNSAu+QOVlXbMyoY+pHSqcw==",
112+
"dependencies": {
113+
"Microsoft.Extensions.Configuration": "8.0.0",
114+
"Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0",
115+
"Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0"
116+
}
117+
},
118+
"Microsoft.Extensions.Diagnostics.Abstractions": {
119+
"type": "Transitive",
120+
"resolved": "8.0.0",
121+
"contentHash": "JHYCQG7HmugNYUhOl368g+NMxYE/N/AiclCYRNlgCY9eVyiBkOHMwK4x60RYMxv9EL3+rmj1mqHvdCiPpC+D4Q==",
122+
"dependencies": {
123+
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
124+
"Microsoft.Extensions.Options": "8.0.0",
125+
"System.Diagnostics.DiagnosticSource": "8.0.0"
126+
}
127+
},
128+
"Microsoft.Extensions.Logging": {
129+
"type": "Transitive",
130+
"resolved": "8.0.0",
131+
"contentHash": "tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==",
132+
"dependencies": {
133+
"Microsoft.Extensions.DependencyInjection": "8.0.0",
134+
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
135+
"Microsoft.Extensions.Options": "8.0.0"
136+
}
137+
},
69138
"Microsoft.Extensions.Logging.Abstractions": {
70139
"type": "Transitive",
71140
"resolved": "8.0.3",
@@ -83,6 +152,18 @@
83152
"Microsoft.Extensions.Primitives": "8.0.0"
84153
}
85154
},
155+
"Microsoft.Extensions.Options.ConfigurationExtensions": {
156+
"type": "Transitive",
157+
"resolved": "8.0.0",
158+
"contentHash": "0f4DMRqEd50zQh+UyJc+/HiBsZ3vhAQALgdkcQEalSH1L2isdC7Yj54M3cyo5e+BeO5fcBQ7Dxly8XiBBcvRgw==",
159+
"dependencies": {
160+
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
161+
"Microsoft.Extensions.Configuration.Binder": "8.0.0",
162+
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
163+
"Microsoft.Extensions.Options": "8.0.0",
164+
"Microsoft.Extensions.Primitives": "8.0.0"
165+
}
166+
},
86167
"Microsoft.Extensions.Primitives": {
87168
"type": "Transitive",
88169
"resolved": "8.0.0",
@@ -93,6 +174,11 @@
93174
"resolved": "8.0.14",
94175
"contentHash": "eg5HYSshwlO1oOzOg4WdT2ZSPKOu3hv556zPkfNpKEi5qoLuQt49mE1tegsL4H7ENl1dL0vBLRv4+YAuLKt/nA=="
95176
},
177+
"System.Diagnostics.DiagnosticSource": {
178+
"type": "Transitive",
179+
"resolved": "8.0.0",
180+
"contentHash": "c9xLpVz6PL9lp/djOWtk5KPDZq3cSYpmXoJQY524EOtuFl5z9ZtsotpsyrDW40U1DRnQSYvcPKEUV0X//u6gkQ=="
181+
},
96182
"System.IO.Pipelines": {
97183
"type": "Transitive",
98184
"resolved": "8.0.0",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.5

PackageSettings.props.local

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<IsLocalDev>true</IsLocalDev>
88
<UseBCLProjectReference>false</UseBCLProjectReference>
99
<!--qqqqqq come back to why did i stop using local env variable after git tags may want to rename this bclversionlocal and automate it with build number, and put a shared file so other solutions can use it like lh with now version updates in development-->
10-
<BCLVersion>3.0.2</BCLVersion>
10+
<BCLVersion>3.0.5</BCLVersion>
1111
</PropertyGroup>
1212
</Project>

ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
## qqqq unlike in nuget feed git package feed doesnt display this file so to see it you need to look in the actual nuget package
23
# About
34

45

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,68 @@
11
@inherits LayoutComponentBase
2+
3+
4+
5+
<span class="version-display">@Package.BlazorComponentLibrary.BCLVersion.VersionInfo.Version</span>
26
<h1>Main Page Layout</h1>
37
@Body
4-
<h1>Main Page Layout</h1>
8+
<h1>Main Page Layout</h1>
9+
10+
11+
12+
13+
14+
@* @code {
15+
public string Version { get; private set; } = "Unknown";
16+
protected override async Task OnInitializedAsync()
17+
{
18+
try
19+
{
20+
Version = await Http.GetStringAsync("bclversion.txt");
21+
}
22+
catch (Exception)
23+
{
24+
Version = "Error fetching version";
25+
}
26+
}
27+
} *@
28+
@* // try
29+
// {
30+
31+
32+
// // Try multiple approaches to find the assembly
33+
// var assemblies = AppDomain.CurrentDomain.GetAssemblies();
34+
35+
// // Method 1: Look for exact assembly name
36+
// var assembly = assemblies.FirstOrDefault(a =>
37+
// a.GetName().Name == "LBlazorComponentLibrary.GitPageBlazorWasm" ||
38+
// a.GetName().Name == "Package.BlazorComponentLibrary");
39+
40+
// // Method 2: Try partial match if exact match fails
41+
// if (assembly == null)
42+
// {
43+
// assembly = assemblies.FirstOrDefault(a =>
44+
// a.GetName().Name != null &&
45+
// (a.GetName().Name.Contains("GitPageBlazorWasm", StringComparison.OrdinalIgnoreCase) ||
46+
// a.GetName().Name.Contains("BlazorComponentLibrary", StringComparison.OrdinalIgnoreCase)));
47+
// }
48+
49+
// if (assembly != null)
50+
// {
51+
// Version = assembly.GetName().Version.ToString();
52+
// }
53+
// else
54+
// {
55+
// Version = "Library not found";
56+
57+
// // Optional debugging: Log all assembly names
58+
// // Console.WriteLine("Available assemblies:");
59+
// // foreach (var asm in assemblies)
60+
// // {
61+
// // Console.WriteLine($"- {asm.GetName().Name}");
62+
// // }
63+
// }
64+
// }
65+
// catch (Exception ex)
66+
// {
67+
// Version = $"Error: {ex.Message}";
68+
// } *@

0 commit comments

Comments
 (0)