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
<PackageReference Include="ZeroC.Ice.Slice.Tools" Version="3.8.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="ZeroC.Ice.Slice.Tools" Version="3.8.1" />
<PackageReference Include="ZeroC.Ice.Slice.Tools"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add ZeroC.Ice.Slice.Tools --version 3.8.1
#r "nuget: ZeroC.Ice.Slice.Tools, 3.8.1"
#:package ZeroC.Ice.Slice.Tools@3.8.1
#addin nuget:?package=ZeroC.Ice.Slice.Tools&version=3.8.1
#tool nuget:?package=ZeroC.Ice.Slice.Tools&version=3.8.1
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
.icefiles to C#.csfiles using theslice2cscompiler. - Incremental Build Support: Only recompiles Slice
.icefiles 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.
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.
|