IceRpc.Slice.Tools 0.1.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package IceRpc.Slice.Tools --version 0.1.1                
NuGet\Install-Package IceRpc.Slice.Tools -Version 0.1.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="IceRpc.Slice.Tools" Version="0.1.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.
paket add IceRpc.Slice.Tools --version 0.1.1                
#r "nuget: IceRpc.Slice.Tools, 0.1.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.
// Install IceRpc.Slice.Tools as a Cake Addin
#addin nuget:?package=IceRpc.Slice.Tools&version=0.1.1

// Install IceRpc.Slice.Tools as a Cake Tool
#tool nuget:?package=IceRpc.Slice.Tools&version=0.1.1                

Slice Tools for IceRPC

IceRpc.Slice.Tools allows you to compile Slice definitions (in .slice files) into C# code (in .cs files) within MSBuild projects.

This package includes the Slice compiler for C#, slicec-cs. This compiler is a native tool with binaries for Linux (x64 and arm64), macOS (x64 and arm64) and Windows (x64).

Once you've added the IceRpc.Slice.Tools NuGet package to your project, the Slice files of your project are automatically compiled into C# files every time you build this project.

When slicec-cs compiles a Slice file and the resulting .cs file is identical to the existing output .cs file, the existing .cs file is kept as-is; the output file is overwritten only when something changed.

Source code | Package | slicec-cs options | Slice documentation

Slice files and Slice directories

The Slice compiler for C# accepts two main inputs:

  • the Slice files to compile into C# code (the Slice files)
  • directories that contain reference Slice files (the Slice directories)

The Slice compiler parses the reference Slice files found in the Slice directories but does not generate code for them. They typically contain definitions referenced by the source Slice files.

The Slice files and Slice directories can overlap.

You select which files to include in your project's Slice files with the SliceFile item type. And you select which directory to include in your project's Slice directories with the SliceDirectory item type.

By default, all .slice files located in your project's home directory and any of its subdirectories, recursively, are included in SliceFile. You can prevent this auto-inclusion of .slice files by setting either EnableDefaultItems or EnableDefaultSliceFileItems to false. The default value of these properties is true.

You can also add Slice files to your project explicitly. For example:

<ItemGroup>
    <SliceFile Include="../Greeter.slice"/>
</ItemGroup>

This adds Greeter.slice to your project's Slice files even though this file is not in the project's home directory or any of its subdirectories.

Slice files must have a .slice extension.

The Slice directories are an aggregate of the SliceDirectory defined in your project (if any) and the SliceDirectory defined in NuGet packages referenced by your project.

For example:

<ItemGroup>
    
    <SliceDirectory Include="$(MSBuildThisFileDirectory)../common/slice"/>
</ItemGroup>

Slice directory and NuGet package

As a general rule, when you package an assembly in a NuGet package and this assembly exports C# symbols generated by the Slice compiler for C#, you should include the corresponding Slice files in your NuGet package. This allows consumers of your NuGet package to easily retrieve these Slice files.

You can also define SliceDirectory in this NuGet package so that any project that references this package automatically sees these Slice files when compiling. For example:


<ItemGroup>
    
    <SliceDirectory Include="$(MSBuildThisFileDirectory)../slice"/>
</ItemGroup>

The ZeroC.Slice NuGet package follows this pattern and provides definitions for common Slice types such as WellKnownTypes::Duration, WellKnownTypes::TimeStamp and WellKnownTypes::Uri.

SliceFile item metadata

You can use the following SliceFile item metadata to customize the compilation and packaging of your Slice files. Each unique set of options results in a separate execution of slicec-cs.

Name Default Description
AdditionalOptions Specifies additional options to pass to slicec-cs.
OutputDir generated Sets the output directory for the generated code. This metadata corresponds to the --output-dir option of slicec-cs.
Pack false Specifies whether or not to include the items (Slice files) in the NuGet package.
PackagePath slice Sets the target path in the NuGet package. Used only when Pack is true.

Generated code and NuGet packages

You need to reference the following NuGet packages to compile the generated C# code:

AdditionalOptions NuGet package reference
--rpc icerpc or no --rpc option IceRpc.Slice
--rpc none ZeroC.Slice

Referencing IceRpc.Slice makes your project reference transitively ZeroC.Slice, IceRpc and System.IO.Pipelines.

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 IceRpc.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
0.4.0.1 143 9/17/2024
0.4.0 112 9/16/2024
0.3.1 1,306 3/28/2024
0.3.0 525 2/14/2024
0.2.1 621 12/12/2023
0.2.0 416 12/4/2023
0.1.2 467 10/9/2023
0.1.1 234 9/18/2023
0.1.0 267 9/6/2023