You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During build, before compilation, task will generate into MyProject\obj\Debug\netcoreapp2.1\MyProject.orleans.g.cs. That cs will compiled into dll with all manually typed cs.
There is obj\Debug\netcoreapp2.1\codegen folder either, which seems used to cache some parts to speed up regeneration.
Also XUnit has some kind of task.
This way you may nuget provider which, as soon as attached, will allow to do custom units as part of dev work.
I hope web search will reveal some tutorials of doing so.
My case. Sometimes I want units with custom validations, e.g. from -100 to 100, or from 1 to 100, or from 0 to 100, or from 0 to 1024. So I may quantize them and store-wire them in most efficient manner and same time have typed logic in my code. And same time use generator to generate all fancy stuff. I want limited sizes, percentages, fractions, limited speeds, etc.
There are various attempts to do codegen (run csx files on prebuild as part of task, t4, customization of roslyn with forks and proposals, writing new F# language:) ). But I guess custom MSBuild task is most production ready (with know path to nuget it, good versatile integration into build system), with DSL to describe units in Csharp and errors in build if wrong DSL usage.
Activity
dzmitry-lahoda commentedon Jan 16, 2019
Use MS Build. Right now many and even more parse with Roslyn local definitions in cs and generate code.
JohanLarsson commentedon Jan 16, 2019
I have never thought of using MSBuild fore code gen, do you have a doc link for how it is done?
dzmitry-lahoda commentedon Jan 16, 2019
https://github.com/dotnet/orleans/tree/master/src/Orleans.CodeGenerator.MSBuild
How does it work?
Add package to
MyProjectMark any interface as
IGrainWithGuidKey.During build, before compilation, task will generate into
MyProject\obj\Debug\netcoreapp2.1\MyProject.orleans.g.cs. That cs will compiled into dll with all manually typed cs.There is
obj\Debug\netcoreapp2.1\codegenfolder either, which seems used to cache some parts to speed up regeneration.Also XUnit has some kind of task.
This way you may
nugetprovider which, as soon as attached, will allow to do customunitsas part of dev work.I hope web search will reveal some tutorials of doing so.
My case. Sometimes I want units with custom validations, e.g. from -100 to 100, or from 1 to 100, or from 0 to 100, or from 0 to 1024. So I may quantize them and store-wire them in most efficient manner and same time have typed logic in my code. And same time use generator to generate all fancy stuff. I want limited sizes, percentages, fractions, limited speeds, etc.
dzmitry-lahoda commentedon Jan 16, 2019
There are various attempts to do codegen (run csx files on prebuild as part of task, t4, customization of roslyn with forks and proposals, writing new F# language:) ). But I guess custom MSBuild task is most production ready (with know path to nuget it, good versatile integration into build system), with DSL to describe units in Csharp and errors in build if wrong DSL usage.