Skip to content

Commit

Permalink
#1144 Optimise TFM's and packages to achieve low/ no dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson-tomo committed Mar 30, 2024
1 parent 00264e5 commit 3c53373
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/protobuf-net.AspNetCore/protobuf-net.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<RootNamespace>ProtoBuf.AspNetCore</RootNamespace>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyName>protobuf-net.AspNetCore</AssemblyName>
Expand All @@ -12,6 +12,9 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<ProjectReference Include="..\protobuf-net\protobuf-net.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.IO.Pipelines" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions src/protobuf-net.Core/protobuf-net.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<RootNamespace>ProtoBuf</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand All @@ -13,9 +13,10 @@

<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0'">
<!-- we use the AddRange span API from v7 -->
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>
Expand Down
11 changes: 8 additions & 3 deletions src/protobuf-net.MessagePipes/protobuf-net.MessagePipes.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<RootNamespace>ProtoBuf.MessagePipes</RootNamespace>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyName>protobuf-net.MessagePipes</AssemblyName>
Expand All @@ -12,12 +12,17 @@

<ItemGroup>
<PackageReference Include="Pipelines.Sockets.Unofficial" />
<PackageReference Include="System.Threading.Channels" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.Threading.Channels" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="System.Threading.Channels" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf-net/protobuf-net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<AssemblyName>protobuf-net</AssemblyName>
<Title>protobuf-net</Title>
<Description>Provides simple access to fast and efficient "Protocol Buffers" serialization from .NET applications</Description>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Configurations>Debug;Release</Configurations>
Expand Down
4 changes: 3 additions & 1 deletion src/protogen/protogen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
<ItemGroup>
<ProjectReference Include="../protobuf-net/protobuf-net.csproj" />
<ProjectReference Include="../protobuf-net.Reflection/protobuf-net.Reflection.csproj" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="protobuf-net.Grpc.Reflection" Condition="'$(GrpcTools)'=='true'" />
<PackageReference Include="Grpc.Net.Client" Condition="'$(GrpcTools)'=='true'" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>
</Project>

0 comments on commit 3c53373

Please sign in to comment.