This directory contains C# sample programs for various Ice components. These examples are provided to get you started on using a particular Ice feature or coding technique.
Most of the subdirectories here correspond directly to Ice components, such as Glacier2, IceBox, and so on. We've also included the following additional subdirectories:
-
Manual contains complete examples for some of the code snippets in the Ice manual.
Refer to the C++11 demos for more examples that use the Ice services (Glacier2, IceGrid, IceStorm).
In order to build Ice for .NET sample programs, you need all of the following:
- the .NET SDK version 6.0 or later
- Slice to C# compiler, for Windows platform the Slice to C# compiler is included
with the
zeroc.ice.net
NuGet package installed during build, for other platforms refer to the Release Notes.
You can build from the command-line or with Visual Studio 2022 for Windows.
Open a command prompt and change to the csharp
subdirectory:
cd csharp
To build the sample programs run:
dotnet restore "C# NET demos.sln"
dotnet msbuild "C# NET demos.sln"
The demos are configured to use the Ice NuGet packages. These packages are automatically downloaded from nuget.org during the build.
Open a command prompt and change to the csharp
subdirectory:
cd csharp
Install packages from the source build:
On Windows
msbuild /p:IceHome=<Ice dist path> /t:NetInstallLocalPackages msbuild\ice.proj
On Linux and macOS
dotnet msbuild /p:IceHome=<Ice dist path> /t:NetInstallLocalPackages msbuild/ice.proj
To build the sample programs run:
dotnet restore "C# NET demos.sln"
dotnet msbuild "C# NET demos.sln"
For most demos, you can simply run server
and client
in separate Command
Prompt windows. Refer to the README.md file in each demo directory for the
exact usage instructions.
Some demos require Ice services such as IceGrid and IceStorm that are not
included in the zeroc.ice.net
NuGet package. To run these demos, the simplest
is to first install the Ice binary distribution for your platform and add its bin
directory to your PATH. Please refer to the Release Notes for additional information.