Open fschwiet opened 9 months ago
Currently TypeGen just searches for the first assembly that matches the project's name inside the "project output" folder (by default bin
) and .NET versions are not checked, so this is currently expected. Any old assemblies need to be removed for TypeGen to find the new assembly.
I'm leaving this issue open as a potential improvement.
I recently upgrade a project that usednet6.0 in the csproj to use net8.0. Later when I changed the C# classes that were getting typegen'd I found "dotnet typegen" didn't notice the change. It took me awhile to realize the issue as I had upgraded a bit before needing to change the C# class. To fix the issue I manually removed the net6.0 folders from my projects bin and obj directory. Then typegen started to use net8.0 binaries instead.
My tgconfig.json file is plain:
I do run typegen with a script which I'll include below. It was using typegen 2.5.0, as part of trying to figure out the problem I started to use typegen 5.0.1.
I was curious how "dotnet typegen" should actually pick the framework and build target. I saw that dotnet tools can use a global.json file (https://learn.microsoft.com/en-us/dotnet/core/versions/selection) but I did not see one of those in my solution folder.
I'm really not sure how typegen can know my intention in this case, that I wanted the net8.0 binaries to be used. So I'm not sure this is really a bug, something I should have configured, or just a limitation of the platform.