Source generator Newtonsoft.Json FileNotFoundException #51090
-
How can I use Newtonsoft.Json lib in the source generator project? My generator project
I get
What I already tried:
Nothing works. I keep getting 'Could not load file or assembly' exception. If I comment code line which calls Newtonsoft.Json.JsonConvert class and go to the debugger - then I see Newtonsoft.Json lib in the context.Compilation.ReferencedAssemblyNames array. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Checkout the csproj here https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/SourceGeneratorSamples/SourceGeneratorSamples.csproj also to get to debug, in your execute method of the generator write |
Beta Was this translation helpful? Give feedback.
Checkout the csproj here https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/SourceGeneratorSamples/SourceGeneratorSamples.csproj also to get to debug, in your execute method of the generator write
Debugger.Launch()
then you can debug. VS will ask you which instance etc but you will get it.