Skip to content

Commit 19757c9

Browse files
Reduce the dependency of the external libraries and add the support of .NET 8.0.
1 parent 578c04b commit 19757c9

File tree

6 files changed

+50
-11
lines changed

6 files changed

+50
-11
lines changed

Directory.Packages.props

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
<!-- Versions of the packages -->
5-
<DotNetVersion>9.0.11</DotNetVersion>
5+
<DotNetVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</DotNetVersion>
6+
<DotNetVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0</DotNetVersion>
67
</PropertyGroup>
78
<ItemGroup>
8-
<PackageVersion Include="Azure.Communication.Email" Version="1.1.0" />
9+
<PackageVersion Include="Azure.Communication.Email" Version="1.0.0" />
910
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
1011
<PackageVersion Include="FluentAssertions" Version="7.2.0" />
11-
<PackageVersion Include="FluentValidation" Version="12.1.0" />
12-
<PackageVersion Include="libphonenumber-csharp" Version="9.0.18" />
12+
<PackageVersion Include="FluentValidation" Version="12.0.0" />
13+
<PackageVersion Include="libphonenumber-csharp" Version="9.0.1" />
1314
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNetVersion)" />
1415
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="$(DotNetVersion)" />
1516
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(DotNetVersion)" />
16-
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.13.0" />
17+
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.2" />
1718
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(DotNetVersion)" />
1819
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(DotNetVersion)" />
1920
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(DotNetVersion)" />
2021
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(DotNetVersion)" />
2122
<PackageVersion Include="Microsoft.Extensions.Options" Version="$(DotNetVersion)" />
22-
<PackageVersion Include="Microsoft.Graph" Version="5.96.0" />
23+
<PackageVersion Include="Microsoft.Graph" Version="5.35.0" />
2324
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2425
<PackageVersion Include="Moq" Version="4.20.72" />
2526
<PackageVersion Include="PosInformatique.FluentAssertions.Json" Version="1.6.0" />

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,41 @@ You can install any package using the .NET CLI or NuGet Package Manager.
5656
- Apply standards-based implementations (RFC, E.164, ...).
5757
- Improve consistency across your projects.
5858
- Get lightweight, modular libraries tailored to single responsibilities.
59-
- Add missing building blocks to your projects without introducing a heavyweight framework.
59+
- Add missing building blocks to your projects without introducing a heavyweight framework.
60+
61+
## 📌 .NET and dependency compatibility
62+
63+
All [PosInformatique.Foundations](https://github.com/PosInformatique/PosInformatique.Foundations) packages are designed to be compatible with **.NET 8.0**, **.NET 9.0** and **.NET 10.0**.
64+
65+
To maximize backward compatibility with existing projects, dependencies on external libraries (such as `Microsoft.Graph`, etc.)
66+
intentionally target **relatively old versions**. This avoids forcing you to update your entire solution to the
67+
latest versions used internally by PosInformatique.Foundations.
68+
69+
> Important: It is the responsibility of the application developer to explicitly reference and update
70+
any **transitive dependencies** in their own project if they want to use newer versions.
71+
> See [NuGet dependency resolution](https://learn.microsoft.com/en-us/nuget/concepts/dependency-resolution)
72+
and [transitive dependencies in Visual Studio](https://devblogs.microsoft.com/dotnet/introducing-transitive-dependencies-in-visual-studio/)
73+
for more details.
74+
75+
### Example with Microsoft.Graph
76+
77+
The [PosInformatique.Foundations.Emailing.Graph](https://www.nuget.org/packages/[PosInformatique.Foundations.Emailing.Graph/)
78+
package depends on [Microsoft.Graph](https://www.nuget.org/packages/Microsoft.Graph/) **5.35.0**
79+
for backward compatibility with a wide range of existing projects.
80+
81+
If your application requires a newer version, you can simply add an explicit reference in your project, for example:
82+
83+
```xml
84+
<ItemGroup>
85+
<PackageReference Include="PosInformatique.Foundations.Emailing.Graph" Version="x.y.z" />
86+
<PackageReference Include="Microsoft.Graph" Version="5.96.0" />
87+
</ItemGroup>
88+
```
89+
90+
In this case, your project will use [Microsoft.Graph](https://www.nuget.org/packages/Microsoft.Graph/) **5.96.0**
91+
while still consuming
92+
[PosInformatique.Foundations.Emailing.Graph](https://www.nuget.org/packages/[PosInformatique.Foundations.Emailing.Graph/).
93+
This is **recommended**, especially to benefit from the latest security updates and bug fixes of the underlying dependencies.
6094

6195
## 📄 License
6296

src/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<Project>
1+
<Project>
22

33
<!-- Imports the parent Directory.Build.props if exist -->
44
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
55

66
<PropertyGroup>
7-
<TargetFramework>net9.0</TargetFramework>
7+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
88
<Nullable>enable</Nullable>
99

1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>

tests/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</ItemGroup>
2525

2626
<PropertyGroup>
27-
<TargetFramework>net9.0</TargetFramework>
27+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
2828

2929
<!-- Same code coverage configuration for all the test projects -->
3030
<RunSettingsFilePath>$(SolutionDir)\CodeCoverage.runsettings</RunSettingsFilePath>

tests/Emailing.Azure.Tests/Emailing.Azure.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<ItemGroup>
4+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
5+
</ItemGroup>
6+
37
<ItemGroup>
48
<ProjectReference Include="..\..\src\Emailing.Azure\Emailing.Azure.csproj" />
59
</ItemGroup>

tests/Emailing.Graph.Tests/GraphEmailProviderTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task SendAsync()
4848
requestInfo.HttpMethod.Should().Be(Method.POST);
4949
requestInfo.URI.Should().Be("http://base/url/users/sender%40domain.com/sendMail");
5050

51-
var jsonMessage = KiotaJsonSerializer.DeserializeAsync<SendMailPostRequestBody>(requestInfo.Content).GetAwaiter().GetResult();
51+
var jsonMessage = KiotaJsonSerializer.Deserialize<SendMailPostRequestBody>(requestInfo.Content);
5252

5353
jsonMessage.Message.Attachments.Should().BeNull();
5454
jsonMessage.Message.Body.Content.Should().Be("The HTML content");

0 commit comments

Comments
 (0)