Preliminary documentation for Ice 3.7.1 Beta. Do not use in production applications. Refer to the space directory for other releases.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page provides important information for .NET developers.

On this page:

Building Ice Applications for .NET with Visual Studio

Install the following software on your Windows system:

  1. A supported version of Visual Studio

  2. The Ice Builder for Visual Studio extension
  3. The NuGet package zeroc.ice.net, described later on this page
  4. Optionally the .NET Core 2.0 SDK if you want to create applications for .NET Core 2.0

Building Ice Applications for .NET with the .NET Core SDK

Install the following software:

  1. The .NET Core 2.0 SDK for your operating system

  2. The NuGet package zeroc.ice.net, described later on this page
  3. The slice2cs compiler

    slice2cs is a command-line tool written in C++ and available on most platforms

    PlatformDistributionPackage with slice2cs
    Ubuntuapt packages

    zeroc-ice-compilers

    (warning) You need to install zeroc-ice-compilers from the 3.7.1 beta repo, as it includes a fix to the generated code for optional. The corresponding bug affects only Linux applications.

    RHELRPMs

    ice-compilers

    (warning) You need to install ice-compilers from the 3.7.1 beta repo, as it includes a fix to the generated code for optional. The corresponding bug affects only Linux applications.

    WindowsNuGetzeroc.ice.net

Programming Language

You can use any .NET programming language with Ice, however, the preferred programming language for Ice .NET applications is C# since:

  • the only Slice language mapping for .NET is Slice to C#
  • the only Slice compiler for .NET, slice2cs, generates C# code
  • Ice for .NET is itself written in C#

zeroc.ice.net NuGet Package

The Ice for .NET (zeroc.ice.net) NuGet package is organized as follows:

 

Folder
Contents
lib\net45Assemblies for .NET Framework 4.5.1
lib\netstandard2.0Assemblies for .NET Standard 2.0
toolsslice2cs.exe, slice2html.exe (Windows-only native tools)
tools\net45

iceboxnet.exe app for .NET Framework 4.5.1, bzip2.dll Windows x64 native library

tools\netcoreapp2.0

iceboxnet.dll app for .NET Core 2.0,  bzip2.dll Windows x64 native library

buildMSBuild support files
sliceSlice files

 


For the 3.7.1 beta release, zeroc.ice.net is available from the beta repository https://dev.zeroc.com/nexus/repository/nuget.ice-v3.7.1-netcore-beta0.

On windows you can add this repository as a new package source using Visual Studio's "Tools > NuGet Package Manager > Package Manager Settings...":

On Linux you need to edit NuGet configuration (~/.nuget/NuGet/NuGet.Config) to add a new package source

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="zeroc.com" value="https://dev.zeroc.com/nexus/repository/nuget.ice-v3.7.1-netcore-beta0/" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

 

.NET Framework and .NET Standard Assemblies

zeroc.ice.net includes two sets of Ice assemblies: one set of assemblies for the .NET Framework 4.5 and another set for .NET Standard 2.0.

These assemblies are the same except for the differences described below:

 .NET Framework 4.5 Assemblies.NET Standard 2.0 Assemblies
Run-time platformWindowsWindows, Linux, macOS
Target Framework.NET Framework 4.5.1 or greater on WindowsAny implementation of .NET Standard 2.0, including .NET Core 2.0 and .NET Framework 4.6.1.
Ice properties can be read from the Windows Registry(tick)(error)
Signals caught by Ice.ApplicationSignal catching implemented using the Windows native function SetConsoleCtrlHandler.Signal catching implemented using the portable .NET event Console.KeyPress.

The .NET Standard 2.0 assemblies are expected to work with any .NET implementation of .NET Standard 2.0, however, they are currently tested and supported only with .NET Core 2.0 on Windows and Linux.

Building Applications with Visual Studio or MSBuild

Adding zeroc.ice.net to a Visual Studio or MSBuild project imports the props and targets files from the build folder into that project.

The props file defines the following properties:

Name
Value
Description
IceVersion3.7Ice string version
IceIntVersion30701Ice version as a numeric value
IceVersionMM3.7Major Minor version
IceSoVersion37Version used in dynamic libraries
IceNugetPackageVersion3.7.1Nuget package numeric version
IceHome$(MSBuildThisFileDirectory)..\..Full path to the package root folder
IceToolsPath$(IceHome)\toolsFull path to the tools folder
These properties are used by the Ice Builder for Visual Studio, and you can also use them in custom build steps.

The targets file defines two MSBuild targets, SliceCompile and SliceClean. SliceCompile compiles Slice files with slice2cs, while SliceClean removes the files generated by slice2cs. The SliceCompile target runs before the default Build target and compile all project items of type Slice. Similarly, the SliceClean target runs before the default Clean target and removes all the files generated by the SliceCompile target.

The SliceCompile target can be customized using the following MSBuild properties:

Name
Default Value
Description
SliceCompiler

Windows: $(IceHome)\tools\slice2cs.exe

Other: /usr/bin/slice2cs

Slice to C# compiler used to compile Slice files.
SliceCompilerOutputDir$(MSBuildThisFileDirectory)generatedOutput directory for the generated code. Correspond to the --output-dir option of slice2cs.
SliceCompilerArgs Extra arguments to pass to the Slice to C# compiler.

Compression with bzip2

Ice for .NET supports the optional compression of Ice requests and responses using the bzip2 native library. The bzip2 native DLL for Windows x64 is included in the zeroc.ice.net package. You can use the bzip2 system library on Linux and macOS.

Using the Sample Programs

Sample programs are available at the ice-demos GitHub repository. You can browse this repository to see build and usage instructions for all supported programming languages. You can clone this repository with:

git clone -b netcore https://github.com/zeroc-ice/ice-demos.git
cd ice-demos

 

  • No labels