-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileLoadException: System.Runtime v6.0.0 when using scaffolder with latest dotnet-7 feed dotnet-ef tool. #27660
Comments
cc: @ajcvickers this is a blocking issue for me. |
I just tested this with updating the runtimes manually and it still does not work. Edit: changed tfm to net 7 and still it fails with the exact same error, it seems the tool itself is broken somewhere. |
This looks to be an issue where something might be referencing the |
According to PerfView: the only thing asking for System.Runtime v6 on this is: System.CommandLine, otherwise the tool uses the .NET 7 copy. |
@AraHaan can this be closed or do you still think there's an EF Core issue here? |
Honestly I am not entirely sure if CommandLine is the root, as well I ran it with dotnet trace and it would not self exit the program without me pressing enter (to have dotnet trace terminate it) 10 minutes later. So it is possible that PerfView might have wrong data. |
@AraHaan we'd need a minimal project which reproduces the problem in order to investigate this. |
I will work on that as soon as I get back to my computer. |
Alright got it done: MyBot.Database.zip (I minimalized it to just the small db and sql code to run so the scaffolder can try to scaffold it) As for the command it's: |
Ah, when I tested again with all the other runtimes, ref packs to them, and the Sdk's that are not 6.0.200/6.0.300-preview it results in this on the command I sent above:
When 2.0.9's runtime is installed, it results in the FileLoadException for 6.0.0's System.Runtime. It seems for some reason the tool wants to require 2.0.0, but then tries to roll forward to 6.0.0 and fail. |
Ok, so I have tested and that #27671 does infact fix this issue. |
This is needed otherwise it will try to require ".NET 2.0 Runtime" to be installed, which will cause roll forward to fail to load 6.0.0's System.Runtime when used on devices with newer versions of the .NET SDK and runtimes. Fixes: dotnet#27660. Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
/cc @bricelam |
Is this really your entire project file? <Project Sdk="Microsoft.NET.Sdk" /> How are you referencing the EFCore packages? How are you running the commands? This error is usually only seen in extreme corner cases where the .runtime.json file doesn't get generated on build. |
…led. This is needed otherwise it will try to require ".NET 2.0 Runtime" to be installed, which will cause roll forward to fail to load 6.0.0's System.Runtime when used on devices with newer versions of the .NET SDK and runtimes. Fixes: dotnet#27660. Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
@bricelam I reference the packages in |
@AraHaan Is there some reason for going down this path instead of using the daily build? |
I thought the dotnet-7 freed versions were the daily builds of dotnet-ef? Also even with the daily build of the .NET runtime it was asking for the 6.0.0 version of System.Runtime before the roll forward patch on the tool called by dotnet-ef. |
@AraHaan If the tooling doesn't work with the 6.0 runtime/SDK installed by the time we ship, then that would be problem. But its early days, so for now, just have 6.0 installed. EF Core 7.0 targets .NET 6.0 anyway, so there is no need to use it with 7.0. |
I tried the preview 5 tool just now and still have this issue. It seems that RollForward was not enough to fix the issue somehow. Looks the only option now is to drop on the src/ef folder all TFM's that are not .NET 6 so that way the tool starts working again. |
Yep changing the src/ef project from netcoreapp2.0 to net6.0 fixed the problem permanently. Note: I did not drop the .NET Framework target at all to prevent possible breaking changes. |
After trying the current preview tool as I must use the preview EFCore builds with .NET 6 due to reasons I cannot control. I still had the tool be broken even with the roll forward. As such I have discovered the reason for this is because of the fact that for some reason even roll forward did not properly tell it how to run as if the tool were compiled for .NET 6. As such the tool had to be patched to change .NET Core 2.0 to .NET 6 in order to get it to work. Fixes dotnet#27660 (comment).
File a bug
When trying to scaffold my database using text templates, the resulting is an FileLoadException after build succeeds.
Include your code
The following is my project files (excluding code and sensitive information):
csproj:
Directory.Build.props:
Directory.Build.targets:
Directory.Packages.props:
nuget.config feeds:
Include stack traces
Include verbose output
Please include
--verbose
output when filing bugs about thedotnet ef
or Package Manager Console tools.Use triple-tick fences for tool output. For example:
Include provider and version information
EF Core version: Latest on dotnet-7 feed.
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6
Operating system: Windows
IDE: Visual Studio 2022 17.2 Preview 2
The text was updated successfully, but these errors were encountered: