Closed pocki closed 2 months ago
Have a similar issue. Going back to "4.9.2" fixed it for now.
Duplicate of #32926
Its not a duplicate, as it is a current problem and not in next major release in half a year
@pocki the problem has already been fixed for 9.0 - the remaining question is about whether to also backport a fix for 8.0. That discussion is happening as part of #32926.
@roj At the mentioned PR there is only an update to v4.8 - this is still not the latest version. And there are breaking changes from 4.9.2 to 4.10
@roji Could you please consider the comment from @pocki . It seems that he mentioned a wrong person in his comment. Right now we cannot add any new EF Core migrations with Microsoft.CodeAnalysis.* packages version 4.10.0 because of this issue. We had to downgrade them to version 4.9.2 for the EF Core tool to work properly.
Ropening to make sure we do the right thing for 9.0 here.
back to previous version solved the problem on my project
@roji To update.
I've consulted about this internally, and we're not going to be changing the Microsoft.CodeAnalysis version in EF 9.0. IIUC upgrading to 4.10.0 would preclude usage of VS 17.8 and 17.9 for no good reason, and the recommendation in general is to not just upgrade unless our analyzers/source generators actually need a feature from the newer versions.
Note that EF 10 will very likely target the net10.0 TFM, at which point older VSs probably won't be supported anyway; there's a good chance we'll upgrade our Microsoft.CodeAnalysis as well. Until then, the workaround above of manually using 4.9.2 (or whatever works) seems very reasonable.
@roji Thanks for the update. That means that now (.NET8) and .NET9 app with EF Core (Code first) can't use actual Microsoft.CodeAnalysis or any dependency that uses an actual version of it.
My case as example: I can't use .NET9 and EF Core together with Microsoft.Powershell.SDK 7.5 (Powershell 7.5 is based on .NET9) This is a weird situation and should last for at least ~ 1,5 years. (as since june 2024 not the latest version is possible to use)
@pocki I understand, and it's indeed an unfortunate situation. The thing is that we're not seeing a lot of people using EF through Microsoft.Powershell.SDK, or running into other similar issues - this issue has only one vote... And upgrading to 4.10.0 brings its own problems as we've seen.
The good news is at least that this problem will at some point go away on its own, and until then there seems to be a decent workaround, with the user explicitly setting the version to 4.9.2 etc. Hopefully that's good enough for the time being.
Hm, so to answer my question here https://github.com/dotnet/efcore/issues/32070#issuecomment-2378803963, it seems it's not possible to upgrade even in .NET 9. :-|
Bug Microsoft.CodeAnalysis.* version dependencies
ASP.NET Core Web API with EF Core 8.0 I need to reference Microsoft.CodeAnalysis.* directly with a newer version (instead of v4.5.0) because of other dependencies like Powershell.SDK - see #32070
This was working fine until v4.9.2 of Microsoft.CodeAnalysis.* packages. Except the warning about version mismatch. After update to v4.10.0 the Add-Migration crashes.
Please make it working also with newer versions of Microsoft.CodeAnalysis. and don't stick to an (very) old version.
Directory.Packages.props:
Stack traces
Provider and version information
EF Core version: 8.0.6 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET 8.0 Operating system: Windows 11 23H2 (Build 22631.3737) IDE: Visual Studio 2022 17.10 and Visual Studio 2022 17.11 Preview 2.0