Innovenergy_trunk/csharp/Lib/Generators/Gen.cs

25 lines
631 B
C#

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