-
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
dotnet-ef needs to target 6 #27787
Comments
cc @richlander @vitek-karas @agocke Looks to me like this is using 5.0 bits not 6.0. I believe that's not supported you need to use 6.0 for macos ARM64. The 6.0 host is aware of architecture-specific runtime locations. Pre-6.0 host is not (since we didn't have an ARM64 6.0 installer. |
This is a question for the tool install folks @marcpopMSFT @wli3 @joeloff -- what happens if a tool is installed using the ARM64 version but then tries to run using x64? Presumably using the x64 apphost will not work. |
Yes, it shouldn't. Emulation for x64 is supported on arm64, but arm64 on x64 is not supported AFAIK. Wouldn't tools mostly be MSIL instead of native code? |
I think this is about |
I believe At the moment I'm not even sure this scenario should work -- should dotnet tools be shared across architecture or should they be separately installed? |
Forgot to mention, the x64 version info is: > dnx64 --info
.NET SDK (reflecting any global.json):
Version: 5.0.401
Commit: 4bef5f3dbf
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.0
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/x64/sdk/5.0.401/
Host (useful for support):
Version: 5.0.10
Commit: e1825b4928
.NET SDKs installed:
5.0.401 [/usr/local/share/dotnet/x64/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.10 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.10 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download |
There is a whole design from Rich and it is implmeneted. Let me find the reference |
Thanks @wli3. There are multiple parts here:
|
I guess this still doesn't quite answer the question for me -- right now if you take two zip files of the runtime and extract them separately and do This isn't really an architecture question, just a question about the scope of |
The current behavior is, |
So back to the original bug, if the customer had used the 6.0 sdk and specified -a to target x64 during install, at that point they can use the x64 emulated install to run the tool. Leaving open as discussion is still ongoing but it's not clear that there is a 6.0 bug. |
I agree -- it's not clear to me there is a bug here, as installing in ARM64 and running in x64 doesn't necessarily seem to be a supported scenario. |
I just tried this on RC2. Looks good. You will see an error message, but that's because I don't have the right runtime installed. The key thing is that it see that the app is .NET 5 and creates an x64 host. That's the desired behavior. rich@MacBook-Air-M1-2020 app % dotnet tool install -g dotnet-serve
You can invoke the tool using the following command: dotnet-serve
Tool 'dotnet-serve' (version '1.9.71') was successfully installed.
rich@MacBook-Air-M1-2020 app % dotnet-serve
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '5.0.0' (x64) was not found.
- The following frameworks were found:
3.1.19 at [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
6.0.0-rc.2.21470.37 at [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
6.0.0-rc.2.21475.12 at [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=x64&rid=osx.11.1-x64 I can also coerce the tool to run on Arm64: rich@MacBook-Air-M1-2020 app % dotnet tool install -g dotnet-serve -a arm64
Skip NuGet package signing validation. NuGet signing validation is not available on Linux or macOS https://aka.ms/workloadskippackagevalidation .
You can invoke the tool using the following command: dotnet-serve
Tool 'dotnet-serve' (version '1.9.71') was successfully installed.
rich@MacBook-Air-M1-2020 app % dotnet-serve
zsh: killed dotnet-serve
rich@MacBook-Air-M1-2020 app % codesign -s - ~/.dotnet/tools/dotnet-serve
rich@MacBook-Air-M1-2020 app % dotnet-serve
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '5.0.0' (arm64) was not found.
- The following frameworks were found:
6.0.0-rc.2.21470.37 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
6.0.0-rc.2.21475.12 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=arm64&rid=osx.11.1-arm64
rich@MacBook-Air-M1-2020 app % export DOTNET_ROLL_FORWARD=LatestMajor
rich@MacBook-Air-M1-2020 app % dotnet-serve
Starting server, serving .
Listening on:
http://localhost:52868
Press CTRL+C to exit
^C% Minus the I think we can close the issue as a result. Yes? /cc @sfoslund |
To the original issue in this thread: This doesn't explain the failure though - the
You can also try: export COREHOST_TRACE=1
export COREHOST_TRACEFILE=host.txt
dnx64 ef
export COREHOST_TRACE=0 The produces |
To add some context to my use case... I have a 'Company.DbContexts' project that targets net5.0. I would like to have dotnet 5 and dotnet 6 (arm64) installed side by side to use them both for different projects. When running ➜ Company.DbContexts git:(develop) ✗ file ~/.dotnet/tools/dotnet-ef
/Users/username/.dotnet/tools/dotnet-ef: Mach-O 64-bit executable arm64
➜ Company.DbContexts git:(develop) ✗ export DOTNET_ROOT=/usr/local/share/dotnet/x64
➜ Company.DbContexts git:(develop) ✗ dnx64 ef --help
Failed to load /usr/local/share/dotnet/x64/host/fxr/5.0.10/libhostfxr.dylib, error: dlopen(/usr/local/share/dotnet/x64/host/fxr/5.0.10/libhostfxr.dylib, 1): no suitable image found. Did find:
/usr/local/share/dotnet/x64/host/fxr/5.0.10/libhostfxr.dylib: mach-o, but wrong architecture
/usr/local/share/dotnet/x64/host/fxr/5.0.10/libhostfxr.dylib: mach-o, but wrong architecture
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/x64/host/fxr/5.0.10/libhostfxr.dylib failed
- Installing .NET prerequisites might help resolve this problem.
https://go.microsoft.com/fwlink/?linkid=2063366
➜ Company.DbContexts git:(develop) ✗ unset DOTNET_ROOT
➜ Company.DbContexts git:(develop) ✗ dnx64 ef --help
Entity Framework Core .NET Command-line Tools 5.0.10
Usage: dotnet ef [options] [command]
Options:
--version Show version information
-h|--help Show help information
-v|--verbose Show verbose output.
--no-color Don't colorize output.
--prefix-output Prefix output with level.
Commands:
database Commands to manage the database.
dbcontext Commands to manage DbContext types.
migrations Commands to manage migrations.
Use "dotnet ef [command] --help" for more information about a command. Seems like arm64 ef is trying to load x64 files and then dies because of the arch mismatch. Makes sense. Continuing from the above setup, ➜ Company.DbContexts git:(develop) ✗ dnx64 ef database update --context MgxContext
Build started...
Build succeeded.
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (arm64) was not found.
- The following frameworks were found:
6.0.0-preview.2.21154.6 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
6.0.0-rc.1.21451.13 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
6.0.0-rc.2.21470.23 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Now it seems the issue is it is unable to find my x64 5.0 install. I think that makes sense? Because ef is arm64 it makes sense that it's not able to utilize the x64 stuff? If I reinstall with ➜ Company.DbContexts git:(develop) ✗ file ~/.dotnet/tools/dotnet-ef
/Users/username/.dotnet/tools/dotnet-ef: Mach-O 64-bit executable x86_64
➜ Company.DbContexts git:(develop) ✗ export DOTNET_ROOT=/usr/local/share/dotnet/x64 # same behavior with or without
➜ Company.DbContexts git:(develop) ✗ dnx64 ef database update --context MgxContext
Build started...
Build succeeded.
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (arm64) was not found.
- The following frameworks were found:
6.0.0-preview.2.21154.6 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
6.0.0-rc.1.21451.13 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
6.0.0-rc.2.21470.23 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=arm64&rid=osx.11.0-arm64 I expected this one to work because ef is x64 and I used dnx64 to call it, but it still seems to want to look for framework in the arm64 directory. Doing ➜ Company.DbContexts git:(develop) ✗ export DOTNET_ROLL_FORWARD=LatestMajor
➜ Company.DbContexts git:(develop) ✗ dnx64 ef database update --context MgxContext
Build started...
Build succeeded.
Confirm that you want to apply the migrations to 'localhost' by typing: localhost
Confirm: localhost
No migrations were applied. The database is already up to date.
Done. Coming from the thought that it is trying to find the framework version to use in the arm64 directory, I think it makes sense why I attached a trace where I was able to get this working, and one where it did not work. From the trace it looks like ef isn't aware of to how to figure out the "correct" (x64) dotnet install to use to build the project. That makes sense in my mind why it seems to always fallback to the arm64 install to try and find the 5.0 framework. Both cases were executed with > cat /etc/dotnet/install_location
/usr/local/share/dotnet/x64
arm64=/usr/local/share/dotnet |
Thanks you for the details! I had to revert back to .NET 6 SDK RC1 (x64 macOS) when I realized that my tools stopped working in the ARM64 builds. Tye and so on, which are dependant on older framework versions. After deleting and re-installing the frameworks,
Opened the file and changed it to:
Then everything is working again. I will not update to .NET 6 for such an unstable release as RC2. I under-estimated the breaking changes. |
I had the issue with running |
In my case, even |
To my knowledge the .NET 5 macOS x64 installer has not yet been updated to know about the different location on arm64 hardware. It should be available in 6.0 GA timeframe. But currently it will install "over" the arm64 6.0 RC2 install causing a mix of arm64 and x64 binaries on disk. To be able to fully validate this, you can run |
The latest update on the current state of things and what is planned for 6.0 GA is here: dotnet/sdk#22380. |
Just had to use dotnet ef today and it couldn't work without @tylermichael 's workaround ( What I have installed: Note: dotnet64 is ➜ ~ dotnet64 --list-sdks 3.1.415 [/usr/local/share/dotnet/x64/sdk] 6.0.100 [/usr/local/share/dotnet/x64/sdk] ➜ ~ dotnet --list-sdks 6.0.100 [/usr/local/share/dotnet/sdk] |
I'm running into this exact same issue (see #26663). I'm a new dotnet dev on Apple M1. My current pain points:
The new developer experience is very confusing! Some suggestions to help improve this:
Thanks for all the hard work 🙏 I understand that there is a LOT of moving parts here and I'm looking forward to a smoother new dev install experience soon. |
WorkaroundYou should be able to get it to work if you use the following to install it. dotnet tool install -g -a arm64 dotnet-ef |
Running this gives the following error
However, this is working |
The workaround version only works if two things are true:
That makes it a not completely compelling workaround. It also needs to be better explained. |
Can you point me to a workaround I can apply to make the following work on Windows ARM64? I have installed .NET SDK 6.0.202 using the ARM64 installer (which contains the .NET runtimes, see https://dotnet.microsoft.com/en-us/download/dotnet/6.0). Executing
on my ASP.NET Core project yields
|
As a test, can you try (before running that command): set DOTNET_ROLL_FORWARD=Major |
Tried. Same Error shown. |
Can you enable tracing and share the result (preferably as a link to a gist)? Instructions: https://github.com/dotnet/runtime/blob/main/docs/design/features/host-tracing.md |
Update: I just found out that issuing
updated the version to 6.0.4. After that the migration command works as expected. I am happy now. Thanks for your help anyway! |
Strange. Glad to hear that it helped. I don't know why, however. |
I believe adding I also don't know why the |
Hmm... ;-)
I think the ef CLI tools were already installed as ARM64 binaries. At least they were identical to the ARM64 ones provided on https://dotnet.microsoft.com/en-us/download/dotnet/6.0 (I did a binary comparison). |
Back to the actual issue ... upon further investigation, we actually need this package to do two things:
For folks reading this, the shim isn't something that most tools creators need to worry about. It's a Microsoft policy for signing binaries and doesn't apply to others (although anyone is free to do it). We may do the same for Linux and macOS later, but we're starting with completing the full set of supported Windows architectures for the moment. |
Also adds a shim we can sign for win-arm64 and rolls ef.dll forward across major runtime versions. Fixes dotnet#27787, fixes dotnet#27827
Thanks @bricelam! |
hey @preetikr, I'm using version 6.0.5 and still getting error. Could it be that 6.0.4 is the only working one? |
I'm trying to get x64 and amd64 to play nicely together on my machine.
I've followed the steps here and so far things seem to be ok for normal usage.
However, when I run this I get:
dnx64 is
alias dnx64="/usr/local/share/dotnet/x64/dotnet"
I installed the ef tool with dotnet 6 arm64 version.
The dotnet-ef binary is arm64 but I'm trying to execute it with my x64 dotnet install.
Any ideas how I can get this to work?
The text was updated successfully, but these errors were encountered: