Generate C# code with Roslyn and .NET Core -
is there way generate c# code using roslyn .net core. i've tried using syntaxfactory package microsoft.codeanalysis.csharp. problem i'm stuck getting proper formatted code text it.
all samples i've seen far use like
var ws = new customworkspace(); ws.options.withchangedoption (csharpformattingoptions.indentbraces, true); var code = formatter.format (item, ws);
the problem here is, use package microsoft.codeanalysis.csharp.workspaces isn't compatible .net core @ moment. there alternative routes or workarounds using roslyn code generator .net core?
the package microsoft.codeanalysis.csharp.workspaces
1.3.2 supports netstandard1.3
, should compatible .net core. depends on microsoft.composition
1.0.27, supports portable-net45+win8+wp8+wpa81
. framework moniker compatible .net core, if import in project.json.
that means make work, relevant sections of project.json should this:
"dependencies": { "microsoft.codeanalysis.csharp.workspaces": "1.3.2" }, "frameworks": { "netcoreapp1.0": { "dependencies": { "microsoft.netcore.app": { "type": "platform", "version": "1.0.0" } }, "imports": "portable-net45+win8+wp8+wpa81" } }
Comments
Post a Comment