Sergio0694/PolySharp

polysharp dont generate source

singsong2016 opened this issue · 2 comments

in my netframework4.8 console project, after added reference to polysharp, and set language version to C#11.0, there is no source file generated, and when i use required and init in my code, there is build error occured

I have the same issue with a .net framework 4.6.2 class library (and console app).
I have tried with a NET Core 3.1 project without any problems.

It seems that the source generators assembly doesn't get registered in the analyzers section of the project.

It's probably not recommended, but I was able to make it work by adding the reference manually to PolySharp.SourceGenerators.dll

1- Add Analyzer
image

2- Navigate to the package of the project and add a reference to PolySharp.SourceGenerators.dll
image

image

After that it worked flawlessly for me.

Only problem with this is that the version doesn't get updated when there is a package update and I need to re-add the reference the newest dll.

Hope this could help to pinpoint the problem.

Seems like a duplicate of #39. You'll need to switch to using an SDK-style .csproj project 🙂
Source generators are not supported with legacy style NETFX projects and will not be loaded correctly.