I very recently ran into this when trying to run an existing .NET 8.0 in-process Azure fn project, where my colleagues were able to run fine. I was running into the same error, but with a different package. Similarly to others, downgrading the package that was causing the issues lead me to successful run!
I found a nice way of tracking down where the issue is coming from, as in my project we were including ProjectReferences in our .csproj file.
If you get the package which is causing an issue, and independently try and install that package but an earlier version, an error will pop-up and tell you that you're not allowed to downgrade the package! And helpfully....a path to the exact .csproj's which contain the package. It will also identify packages which have a dependency which is that errored package.
Funnily enough though, once I managed to get it running once, I stashed all of my changes, cleaned the solution, and it still just works...not really sure why. A file must have been generated somewhere which it was complaining about