Skip to content
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

Chapter 10 - 'Scaffolding models using an existing database' failed on M1 Mac with ARM dotnet #45

Closed
ntsiatinis opened this issue Mar 30, 2022 · 1 comment

Comments

@ntsiatinis
Copy link

Just a quick report about an issue I had today with Chapter 10 (not specifically an issue with the book, but took a bit of searching to fix)

Hardware is an M1 Mac Mini, running Monterey, only version of .NET Sdk installed is Core 6(.0.201), ARM version.

Following the dotnet tool install --global dotnet-ef --version 6.0.0 and then adding it to the path appears to work fine at first glance, but running the subsequent steps to scaffold models using the existing database threw up an error...

running the dotnet ef dbcontext [...] resulted in

A fatal error occurred. The required library libhostfxr.dylib could not be found.
If this is a self-contained application, that library should exist in [/Users/[name]/.dotnet/tools/.store/dotnet-ef/6.0.0/dotnet-ef/6.0.0/tools/netcoreapp3.1/any/].
If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet].

After a bit of Googling, seems like there's an issue with the tool installer which made it install the x86 version instead of the ARM version.

Uninstalling the x86 version using dotnet tool uninstall --global dotnet-ef and then following the instructions at dotnet/sdk#21187 (comment) to force the install of the ARM version using dotnet tool install --global dotnet-ef -a arm64 then allowed the dotnet ef dbcontext [...] step further on to work correctly.

Hope this helps someone!

@markjprice
Copy link
Owner

Thank you, Nick!
I have added this issue in the errata:
https://github.com/markjprice/cs10dotnet6/blob/main/errata.md#page-428---setting-up-the-dotnet-ef-tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants