Skip to content

Commit

Permalink
Adding NetStandard support for Abstractions Library
Browse files Browse the repository at this point in the history
Netstandard is still needed in one place down the chain. Updated all other projects to use netcore versions and reduced library targets to the Abstractions project
  • Loading branch information
Neil Richardson committed Mar 14, 2024
1 parent 6cabe60 commit 440a218
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 14 deletions.
8 changes: 6 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<OldestSupportedDotNetVersion>net7.0</OldestSupportedDotNetVersion>
<NetCoreVersions>$(LatestSupportedDotNetVersion)</NetCoreVersions>
<NetCoreVersions Condition="'$(LatestSupportedDotNetVersion)' != '$(OldestSupportedDotNetVersion)'">$(LatestSupportedDotNetVersion);$(OldestSupportedDotNetVersion)</NetCoreVersions>
<LibraryTargetFrameworks>$(NetCoreVersions)</LibraryTargetFrameworks>
<ExecutableTargetFrameworks>$(NetCoreVersions)</ExecutableTargetFrameworks>
<NetStandardVersions>netstandard2.0</NetStandardVersions>
<LibraryTargetFrameworks>$(NetCoreVersions);$(NetStandardVersions)</LibraryTargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="UnitTest Targets">
<UnitTestTargetFrameworks>$(NetCoreVersions)</UnitTestTargetFrameworks>
Expand All @@ -25,6 +25,10 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Label="Condition Variables" >
<IsNetCore>$(NetCoreVersions.Contains('$(TargetFramework)'))</IsNetCore>
<IsNetStandard>$(NetStandardVersions.Contains('$(TargetFramework)'))</IsNetStandard>
</PropertyGroup>
<PropertyGroup Label="Signing" >
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup Label="Latest DotNet Package Versions. AutoUpdate" Condition="'$(TargetFramework)' == '$(LatestSupportedDotNetVersion)'">
<ItemGroup Label="Latest DotNet Package Versions. AutoUpdate" Condition="'$(TargetFramework)' == '$(LatestSupportedDotNetVersion)' OR '$(IsNetStandard)'">
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
Expand Down
1 change: 0 additions & 1 deletion Omex.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
NuGet.Config = NuGet.Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
</ItemGroup>
<ItemGroup Condition="!$(IsNetCore)">
<PackageReference Include="System.Threading.Tasks.Extensions" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Abstractions/Validation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static string ThrowIfNullOrWhiteSpace(string? value, string? name = null)
{
if (!string.IsNullOrWhiteSpace(value))
{
return value;
return value!; // `!` required because in netstandard2.0 IsNullOrWhiteSpace does not have proper attributes
}

_ = value ?? throw new ArgumentNullException(name);
Expand Down
2 changes: 1 addition & 1 deletion src/Activities/Microsoft.Omex.Extensions.Activities.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
<Title>Microsoft.Omex.Extensions.Activities</Title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
Expand Down
2 changes: 1 addition & 1 deletion src/Hosting/Microsoft.Omex.Extensions.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
<Title>Microsoft.Omex.Extensions.Hosting</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/Microsoft.Omex.Extensions.Logging.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
<Title>Microsoft.Omex.Extensions.Logging</Title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Label="NuGet Properties">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="NuGet Properties">
Expand Down

0 comments on commit 440a218

Please sign in to comment.