Roslyn Incremental CodeGen from text files not working
I wrote this codegen dll for internal use in the project, but i cannot reference the generated source code in the "CodeGen" project
Referencing it from "Common" project:
The "CodeGen" csproj:
The codegen source:
15 Replies
What exactly is it you cannot reference in the generator project?
not in the generator project, in Common project

Right, so it works as intended. You can't reference generated code inside the generator which generates that code.
but shouldnt it generate the code in the common project and not internally?
the generator is supposed to generate the file and add it to the common projects references
i dont want to use it in the codegen project, that doesnt make sense
yes it should
then why doesnt it work? :catthinking:
Does it compile if you build it from the comnand line?
i have never built from command line
it builds from IDE
and if i make the generator output invalid syntax the common project fails to build
so thats a good sign
wait it builds
my ide just doesnt want to work properly
intellisens is confused
no nevermind im not sure if it works
This is pretty common with SGs
You can try restarting VS and clearing the cache
didnt work
but i dont think the compilation works properly either
tried putting this in the list of ips

and added this

compilation still succeeds
Your additional files needs to be in the consuming project, not the generator project
Which I did 🤔