Generator (Experiment)
This commit is contained in:
parent
9d4c02745d
commit
cdaed39301
|
@ -0,0 +1,25 @@
|
||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace InnovEnergy.Lib.Generators;
|
||||||
|
|
||||||
|
[Generator]
|
||||||
|
public class MySourceGenerator : ISourceGenerator
|
||||||
|
{
|
||||||
|
public void Initialize(GeneratorInitializationContext context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(GeneratorExecutionContext context)
|
||||||
|
{
|
||||||
|
var file = "/home/eef/sync/work/Code/innovenergy/git/csharp/Lib/Protocols/Modbus/Reflection/Exec.cs";
|
||||||
|
|
||||||
|
File.WriteAllText(file, "");
|
||||||
|
|
||||||
|
throw new Exception("foo");
|
||||||
|
|
||||||
|
foreach (var st in context.Compilation.SyntaxTrees)
|
||||||
|
{
|
||||||
|
File.AppendAllText(file, st.GetText().ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue