Open Gulum opened 2 months ago
Hi Gulum,
There is no plan for this, the MSBuild task just runs the slice2cs compiler which is a C++ binary. Can you elaborate on your use case and why you would prefer to have this in a source generator?
Cheers, Jose
In our company we would like to generate slice files based on c# classes with the help of C# Source Generators. Those generators run as a part of the compiler. The Slice2CS generator runs upfront of the CSC compiler not allowing us to use outputs from the Source Generator. This forces us to also use MSBuild based generators to ensure correct generation order. E.g. Generate .ice files -> Generate C# files (Slice2CS) -> Run C# Compiler.
From my point of view the Source Generators lacks features to allow such a flow anyway.
Both features are already on the Backlog of C#. So i might return to this request :). At the moment my question was out of curiosity if something like this is planned. Not a concrete request. However the mentioned lacking feature would not keep ICE from using Source Generators.
Thanks
This forces us to also use MSBuild based generators to ensure correct generation order. E.g. Generate .ice files -> Generate C# files (Slice2CS) -> Run C# Compiler.
One thing you can try is to run slice2cs from your generator, it shouldn't be too difficult using the Process class.
For [IceRPC] our latest RPC product, we are planning to allow using Slice without Slice files, see https://github.com/icerpc/icerpc-csharp/issues/4011
We are already using Source generators for Services https://docs.icerpc.dev/slice2/language-guide/interface#c#-mapping
And we are planning to move code generation entirely to C# https://github.com/icerpc/icerpc-csharp/issues/3978
How likely is it that the .ice Source file generation for C# will be migrated to C# Source Generators instead of MSBuild task juggling? Are there any plans?