Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Source Generators for class library project in c#

$
0
0

Is this possible to generate code with Source Generator in c# into class library project? I would like this auto-generated code to be packed into Nuget package then.

When I try to build a project made according to the Microsoft(https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview) tutorial I encounter the following error:

CSC : warning CS8785: Generator 'HelloSourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'NullReferenceException' with message 'Object reference not set to an instance of an object.

The only difference is that I am trying to generate code for a class library project, not a console application.

I tried to do it according to the guide posted on Microsoft's website(https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview), but it assumes generating code for an application that has a console interface.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>