Skip to content

Commit

Permalink
Upgrade C# build to target .NET 8.0 (#1976)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Mar 22, 2024
1 parent 5fc9cec commit 3db9bf0
Show file tree
Hide file tree
Showing 146 changed files with 187 additions and 237 deletions.
40 changes: 5 additions & 35 deletions csharp/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resulting binaries. As an alternative, you can download and install the

In order to build Ice for .NET from source, you need:

* Visual Studio 2022 with [.NET 6.0 SDK][2] or [.NET 8.0 SDK][3].
* Visual Studio 2022 with [.NET 8.0 SDK][2].

### Compiling Ice for .NET on Windows

Expand All @@ -44,26 +44,14 @@ msbuild msbuild\ice.proj
> msbuild msbuild\ice.proj /p:Platform=x64
> ```
Upon completion, the Ice assemblies for .NET Standard 2.0 are placed in the `lib\netstandard2.0` folder.
Upon completion, the Ice assemblies for .NET 8.0 are placed in the `lib\net8.0` folder.
You can skip the build of the test suite with the `BuildDist` target:
```shell
msbuild msbuild\ice.proj /t:BuildDist
```
The iceboxnet executable and test applications target `net6.0` You can change
the target framework by setting the `AppTargetFramework` property to a different
Target Framework Moniker value, for example:
```shell
msbuild msbuild\ice.proj /p:"AppTargetFramework=net8.0"
```
This builds the test programs for `net8.0`. The target frameworks you specify
must implement .NET Standard 2.0.
#### Authenticode Signatures
You can sign the Ice binaries with Authenticode by setting the following
Expand All @@ -90,7 +78,7 @@ necessary.
### Linux and macOS Build Requirements
You need the [.NET 6.0 SDK][2] or [.NET 8.0 SDK][3] to build Ice for .NET from source.
You need the [.NET 8.0 SDK][2] to build Ice for .NET from source.
### Compiling Ice for .NET on Linux or macOS
Expand All @@ -106,22 +94,14 @@ Then run:
dotnet msbuild msbuild/ice.proj
```
Upon completion, the Ice assemblies are placed in the `lib/netstandard2.0` directory.
Upon completion, the Ice assemblies are placed in the `lib/net8.0` directory.
You can skip the build of the test suite with the `BuildDist` target:
```shell
dotnet msbuild msbuild/ice.proj /t:BuildDist
```
The iceboxnet executable and test applications target `net6.0`. You can change the target
framework by setting the `AppTargetFramework` property to a different Target Framework Moniker value,
for example:
```shell
dotnet msbuild msbuild/ice.proj /p:"AppTargetFramework=net8.0"
```
## Running the Tests
Python is required to run the test suite. Additionally, the Glacier2 tests
Expand All @@ -141,15 +121,6 @@ python allTests.py
If everything worked out, you should see lots of `ok` messages. In case of a
failure, the tests abort with `failed`.
`allTests.py` executes by default the tests for .NET 6.0. If you want to run
the test with a different .NET Framework you must use `--framework` option.
For example, to run .NET 8.0 tests:
```shell
python allTests.py --framework=net8.0
```
## NuGet Package
### Creating NuGet Packages on Windows
Expand All @@ -176,5 +147,4 @@ This creates the `zeroc.ice.net` Nuget package in the `msbuild/zeroc.ice.net`
directory.
[1]: https://zeroc.com/downloads/ice
[2]: https://dotnet.microsoft.com/en-us/download/dotnet/6.0
[3]: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
[2]: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
2 changes: 1 addition & 1 deletion csharp/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AppTargetFramework Condition="'$(AppTargetFramework)' == ''">net6.0</AppTargetFramework>
<AppTargetFramework Condition="'$(AppTargetFramework)' == ''">net8.0</AppTargetFramework>
</PropertyGroup>
</Project>
10 changes: 5 additions & 5 deletions csharp/msbuild/ice.nuget.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<!--
Pack the dependencies next to iceboxnet.dll, the .exe native executable is excluded as it is platform dependent.
-->
<NetStandardIceBox Include="$(IceSrcRootDir)bin\**\publish\*"
Exclude="$(IceSrcRootDir)bin\**\publish\*.exe" />
<IceBox Include="$(IceSrcRootDir)bin\**\publish\*"
Exclude="$(IceSrcRootDir)bin\**\publish\*.exe" />

<Assemblies Include="$(IceSrcRootDir)lib\**\*.dll;
$(IceSrcRootDir)lib\**\*.xml"/>
<NetStandardPdbs Include="$(IceSrcRootDir)lib\netstandard2.0\*.pdb" />
<Pdbs Include="$(IceSrcRootDir)lib\net8.0\*.pdb" />

<Slices Include="$(IceSrcRootDir)..\slice\**\*.ice"
Exclude="$(IceSrcRootDir)..\slice\IceDiscovery\*.ice;
Expand All @@ -25,9 +25,9 @@
<!-- Copy required files to the package specific directories -->
<Target Name="NugetPack">
<Copy SourceFiles="@(Assemblies)" DestinationFolder="$(PackageDirectory)\lib\%(Assemblies.RecursiveDir)" />
<Copy SourceFiles="@(NetStandardPdbs)" DestinationFolder="$(PackageDirectory)\lib\netstandard2.0" />
<Copy SourceFiles="@(Pdbs)" DestinationFolder="$(PackageDirectory)\lib\net8.0" />
<Copy SourceFiles="@(Slices)" DestinationFolder="$(PackageDirectory)\slice\%(Slices.RecursiveDir)" />
<Copy SourceFiles="@(SliceCompilers)" DestinationFolder="$(PackageDirectory)\tools" />
<Copy SourceFiles="@(NetStandardIceBox)" DestinationFolder="$(PackageDirectory)\tools\%(NetStandardIceBox.RecursiveDir)\.." />
<Copy SourceFiles="@(IceBox)" DestinationFolder="$(PackageDirectory)\tools\%(IceBox.RecursiveDir)\.." />
</Target>
</Project>
11 changes: 5 additions & 6 deletions csharp/msbuild/ice.proj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
</TestSolution>
</ItemGroup>

<!-- NET Standard Targets -->
<Target Name="NuGetRestoreDist" Condition="'$(ICE_BIN_DIST)' != 'all'">
<MSBuild Projects="@(DistSolution)"
BuildInParallel="true"
Expand Down Expand Up @@ -92,7 +91,7 @@

<Target Name="Clean" DependsOnTargets="CleanDist">

<MSBuild Projects="@(NetStandardTestSolution)"
<MSBuild Projects="@(TestSolution)"
BuildInParallel="true"
Properties="%(Properties)"
Targets="Clean" />
Expand All @@ -102,9 +101,9 @@
<Target Name="WindowsNuGetPack" DependsOnTargets="BuildDist" Condition="'$(OS)' == 'Windows_NT'">
<RemoveDir Directories="zeroc.ice.net" />

<!-- Build iceboxnet with net6.0 target framework (default) -->
<!-- Build iceboxnet with net8.0 target framework (default) -->
<MSBuild Projects="$(MSBuildThisFileDirectory)..\src\IceBoxNet\IceBoxNet.csproj"
Properties="Configuration=$(Configuration);Platform=Any CPU;AppTargetFramework=net6.0"
Properties="Configuration=$(Configuration);Platform=Any CPU;AppTargetFramework=net8.0"
Targets="Restore;Publish" />

<MSBuild Projects="ice.nuget.targets"
Expand All @@ -131,7 +130,7 @@
<!-- Copy bzip2 native dll next to iceboxnet assemblies -->
<Copy SourceFiles="$(MSBuildThisFileDirectory)..\..\cpp\msbuild\packages\bzip2.v143.1.0.6.10\build\native\bin\x64\MT-Release\bzip2.dll;
$(MSBuildThisFileDirectory)..\..\cpp\msbuild\packages\bzip2.v143.1.0.6.10\build\native\bin\x64\MT-Release\bzip2.pdb"
DestinationFolder="$(MSBuildThisFileDirectory)zeroc.ice.net\tools\net6.0" />
DestinationFolder="$(MSBuildThisFileDirectory)zeroc.ice.net\tools\net8.0" />

<Copy SourceFiles="zeroc.ice.net.props"
DestinationFiles="zeroc.ice.net\build\zeroc.ice.net.props"/>
Expand All @@ -142,7 +141,7 @@

<Target Name="UnixNuGetPack" DependsOnTargets="BuildDist" Condition="'$(OS)' != 'Windows_NT'">
<RemoveDir Directories="zeroc.ice.net" />
<MSBuild Projects="$(MSBuildThisFileDirectory)..\src\IceBox\msbuild\icebox\netstandard2.0\icebox.csproj"
<MSBuild Projects="$(MSBuildThisFileDirectory)..\src\IceBox\msbuild\icebox\net8.0\icebox.csproj"
Properties="Configuration=$(Configuration);Platform=Any CPU"
Targets="Publish"/>
<MSBuild Projects="zeroc.ice.net.csproj" Targets="Restore;Pack"/>
Expand Down
7 changes: 3 additions & 4 deletions csharp/msbuild/zeroc.ice.net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>2008;8021;NU5128</NoWarn>
<IncludeBuildOutput>false</IncludeBuildOutput>
<PackageType>2.0.0.0</PackageType>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8</TargetFramework>
<OutputPath>zeroc.ice.net</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PackageId>zeroc.ice.net</PackageId>
Expand Down Expand Up @@ -38,9 +37,9 @@
<PackagePath>lib\net6.0</PackagePath>
</Content>

<Content Include="..\lib\netstandard2.0\*.dll">
<Content Include="..\lib\net8.0\*.dll">
<Pack>true</Pack>
<PackagePath>lib\netstandard2.0</PackagePath>
<PackagePath>lib\net8.0</PackagePath>
</Content>

<Content Include="..\bin\$(AppTargetFramework)\publish\*" Exclude="..\bin\$(AppTargetFramework)\publish\iceboxnet">
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Glacier2/Glacier2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>Glacier2</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/$(AssemblyName)/*.ice" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Ice/Ice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>Ice</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/Ice/*.ice" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceBox/IceBox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/IceBox/*.ice" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceBoxNet/IceBoxNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>iceboxnet</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../bin</OutputPath>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Ice/Ice.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceDiscovery/IceDiscovery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>IceDiscovery</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/$(AssemblyName)/*.ice" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceGrid/IceGrid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>IceGrid</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/$(AssemblyName)/*.ice" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceLocatorDiscovery/IceLocatorDiscovery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>IceLocatorDiscovery</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/$(AssemblyName)/*.ice" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceSSL/IceSSL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>IceSSL</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="zeroc.icebuilder.msbuild" Version="5.0.9" PrivateAssets="All" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/IceStorm/IceStorm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>IceStorm</AssemblyName>
<Version>$(IceJSONVersion)</Version>
<OutputPath>../../lib</OutputPath>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SliceCompile Include="../../../slice/$(AssemblyName)/*.ice" />
Expand Down
4 changes: 2 additions & 2 deletions csharp/test/Glacier2/application/msbuild/client/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/netstandard2.0/Glacier2.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Glacier2.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
4 changes: 2 additions & 2 deletions csharp/test/Glacier2/application/msbuild/server/server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/netstandard2.0/Glacier2.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Glacier2.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
4 changes: 2 additions & 2 deletions csharp/test/Glacier2/router/msbuild/client/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/netstandard2.0/Glacier2.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Glacier2.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
4 changes: 2 additions & 2 deletions csharp/test/Glacier2/router/msbuild/server/server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/netstandard2.0/Glacier2.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Glacier2.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/netstandard2.0/Glacier2.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Glacier2.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/netstandard2.0/Glacier2.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Glacier2.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
2 changes: 1 addition & 1 deletion csharp/test/Ice/acm/msbuild/client/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
2 changes: 1 addition & 1 deletion csharp/test/Ice/acm/msbuild/server/server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
2 changes: 1 addition & 1 deletion csharp/test/Ice/admin/msbuild/client/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</When>
<Otherwise>
<ItemGroup>
<Reference Include="../../../../../lib/netstandard2.0/Ice.dll" />
<Reference Include="../../../../../lib/net8.0/Ice.dll" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
Loading

0 comments on commit 3db9bf0

Please sign in to comment.