ZeroC.Ice.Slice.Tools 3.8.1

Prefix Reserved
dotnet add package ZeroC.Ice.Slice.Tools --version 3.8.1
                    
NuGet\Install-Package ZeroC.Ice.Slice.Tools -Version 3.8.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZeroC.Ice.Slice.Tools" Version="3.8.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroC.Ice.Slice.Tools" Version="3.8.1" />
                    
Directory.Packages.props
<PackageReference Include="ZeroC.Ice.Slice.Tools">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZeroC.Ice.Slice.Tools --version 3.8.1
                    
#r "nuget: ZeroC.Ice.Slice.Tools, 3.8.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZeroC.Ice.Slice.Tools@3.8.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZeroC.Ice.Slice.Tools&version=3.8.1
                    
Install as a Cake Addin
#tool nuget:?package=ZeroC.Ice.Slice.Tools&version=3.8.1
                    
Install as a Cake Tool

Slice Tools for Ice and C#

ZeroC.Ice.Slice.Tools provides an MSBuild task for compiling Slice definitions (.ice files) into C# source files (.cs files) automatically as part of your build process.

Source code | Package | slice2cs options | Slice documentation

Features

  • Automatic Slice Compilation: Compiles Slice .ice files to C# .cs files using the slice2cs compiler.
  • Incremental Build Support: Only recompiles Slice .ice files that have changed or have outdated dependencies.
  • Bundled Slice-to-CSharp Compilers: With binaries for Windows (x64), Linux (x64, arm64), and macOS (x64, arm64).
  • Customizable Compilation Options: Allows configuring include directories, additional options, and output directories.

Installation

To use this task, add the NuGet package to your project:

dotnet add package ZeroC.Ice.Slice.Tools

Once installed, Slice files are automatically compiled into C# files every time the project is built.

Configuring Slice Compilation

By default, all .ice files in the project directory and its subdirectories are included in the build. You can disable this behavior by setting either EnableDefaultItems or EnableDefaultSliceCompileItems to false.

For example, to disable automatic inclusion of Slice files, add the following to your .csproj file:

<PropertyGroup>
  <EnableDefaultSliceCompileItems>false</EnableDefaultSliceCompileItems>
</PropertyGroup>

To manually specify which .ice files to compile, use the SliceCompile item type. This is useful when you want to compile Slice files from a directory outside the project directory:

<ItemGroup>
  <SliceCompile Include="../slice/Greeter.ice" />
</ItemGroup>

Metadata for SliceCompile Items

Each SliceCompile item can have metadata attributes that customize the compilation:

Item Metadata Default Value Corresponding slice2cs Option
OutputDir $(MSBuildProjectDirectory)/generated --output-dir
IncludeDirectories -I
AdditionalOptions (any)

Example:

<ItemGroup>
  <SliceCompile Include="../slice/Greeter.ice">
    <IncludeDirectories>../slice/includes</IncludeDirectories>
    <AdditionalOptions>-DFOO</AdditionalOptions>
    <OutputDir>$(IntermediateOutputPath)Generated</OutputDir>
  </SliceCompile>
</ItemGroup>

Troubleshooting

If the Slice Tools task fails, you may want to inspect the exact command used to invoke the Slice-to-C# compiler, as well as the computed properties used to configure the task.

The easiest way to do this is by generating a binary log of the build:

dotnet build -bl:build-log.binlog

You can open this log file using the MSBuild Structured Log Viewer Visual Studio Code extension. Then search for SliceCompile.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on ZeroC.Ice.Slice.Tools:

Repository Stars
icerpc/icerpc-csharp
A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
Version Downloads Last Updated
3.8.1 740 3/2/2026
3.8.0 758 12/16/2025