radimitrov / CSharpShellApp

77 stars 18 forks source link

Sourcegenerator question #264

Open sedoLevi609 opened 1 year ago

sedoLevi609 commented 1 year ago

Can I use Sourcegenerator in your app? If yes, how?

(link: https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview)

I tried but nothing happens

My code in Program(SourceGenerator same as in link example):

namespace Test;

partial class Program { static void Main(string[] args) {
HelloFrom("Generated Code"); }

static partial void HelloFrom(string name);

}

For the SourceGenerator I created console project, but set TargetFramework to netstandard2.0 manually(just modified csproj file)

Added this to main program csproj(with right path):

Screenshot_20230312_151621_com huawei browser

radimitrov commented 1 year ago

It is mostly a build tools feature instead of Roslyn feature, so I will have to implement it explicitly. Also pretty sure this needs to be supported first.