❔ Docker dotnet msbuild fails when using source generator reference
I have a solution with two projects. An aspnet api 'MyApiProject' and a regular class library 'MyLibraryProject'. The library project references a source generator NuGet package 'MyGenerator' I created in a separate solution.
When I build and run the solution in visual studio everything works fine but when I build it through docker it is failing because the class file that is generated "could not be found".
Relevant extract from the docker output:
Relevant parts of my docker file looks like this:
All of this makes me think that its not running the source code generator during the build.
3 Replies
sounds like the source generator isn't getting bundled up in the docker image?
You need to depend on the right version of roslyn
Your docker image only has roslyn 4.3. You're depending on 4.5 in your generator
Remember, your generator is a plugin. You don't get to chose what version of roslyn calls you
If you want to use 4.5, you would need to use a newer version of .NET and the SDK
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.