Generator (Experiment)

This commit is contained in:
ig 2023-06-13 13:02:59 +02:00
parent 9d4c02745d
commit cdaed39301
1 changed files with 25 additions and 0 deletions

View File

@ -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());
}
}
}