© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•14mo ago•
7 replies
AnnaSasDev

Roslyn not finding a referenced package

Hey there
Over the past months I've really fallen in love with writing my own Roslyn code generators. My Discriminated Unions library heavily relies on this, and because I have noticed that some of my generators share the same basic code, I wanted to write a simple library I could use in my various projects : https://github.com/code-of-chaos/cs-code_of_chaos-generator_tools

The issue now is that I try and use the uploaded nuget package in the consumer Roslyn generator found here: https://github.com/AterraEngine/unions-cs/blob/core/src/AterraEngine.Unions.Generators/AterraEngine.Unions.Generators.csproj

Within the IDE (rider) everything seems to be fine in the generator's code as it discovers all the types within the package and I'm able to use them when I'm writing code, but whenever I try and use the generator no code appears and I get the error :
System.IO.FileNotFoundException: Could not load file or assembly 'CodeOfChaos.GeneratorTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'CodeOfChaos.GeneratorTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'
   at AterraEngine.Unions.Generators.UnionGenerator.GenerateUnionCode(UnionObject unionObject)
   at AterraEngine.Unions.Generators.UnionGenerator.GenerateSources(SourceProductionContext context, ValueTuple`2 source) in C:\Dev\unions-cs\src\AterraEngine.Unions.Generators\UnionGenerator.cs:line 163
   at Microsoft.CodeAnalysis.UserFunctionExtensions.<>c__DisplayClass3_0`2.<WrapUserAction>b__0(TInput1 input1, TInput2 input2, CancellationToken token)
System.IO.FileNotFoundException: Could not load file or assembly 'CodeOfChaos.GeneratorTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'CodeOfChaos.GeneratorTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'
   at AterraEngine.Unions.Generators.UnionGenerator.GenerateUnionCode(UnionObject unionObject)
   at AterraEngine.Unions.Generators.UnionGenerator.GenerateSources(SourceProductionContext context, ValueTuple`2 source) in C:\Dev\unions-cs\src\AterraEngine.Unions.Generators\UnionGenerator.cs:line 163
   at Microsoft.CodeAnalysis.UserFunctionExtensions.<>c__DisplayClass3_0`2.<WrapUserAction>b__0(TInput1 input1, TInput2 input2, CancellationToken token)

I've been stuck at this for a few hours now, and I'm lost at where I've created some issue
GitHub
GitHub - code-of-chaos/cs-code_of_chaos-generator_tools: A set of t...
A set of tools to help you create code generators more easily - code-of-chaos/cs-code_of_chaos-generator_tools
GitHub
unions-cs/src/AterraEngine.Unions.Generators/AterraEngine.Unions.Ge...
A Union Library for DotNet. Contribute to AterraEngine/unions-cs development by creating an account on GitHub.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

_sdbModel Model not being referenced
C#CC# / help
3y ago
Rider Roslyn Analyzer Not Working (Partially)
C#CC# / help
9mo ago
Roslyn String Allocation
C#CC# / help
13mo ago
❔ CSharpCompilation using Roslyn
C#CC# / help
3y ago