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

Using dotnet ef 7 tool from with net8 #32155

Closed
wallymathieu opened this issue Oct 24, 2023 · 12 comments
Closed

Using dotnet ef 7 tool from with net8 #32155

wallymathieu opened this issue Oct 24, 2023 · 12 comments

Comments

@wallymathieu
Copy link

wallymathieu commented Oct 24, 2023

Ask a question

In the following project I'm using ef migrations. I noticed that the commands dotnet tool restore; dotnet ef database update failed with

Tool 'dotnet-ef' (version '7.0.5') was restored. Available commands: dotnet-ef

Restore was successful.
Run "dotnet tool restore" to make the "dotnet-ef" command available.

Is it that I should make sure to run the net8 version of the tool? I.e. that if you want to use the previous version you need to use global.json and pin the framework to net7 if you have net8 also installed?

I've tested it on M1 Macbook Air and Windows 11 with net8 rc2 and net7 installed.

@wallymathieu wallymathieu changed the title Using dotnet ef from net7 with net8 Using dotnet ef 7 tool from with net8 Oct 24, 2023
@bricelam
Copy link
Contributor

The tools are backwards compatible. Version 8 of dotnet-ef will work with projects targeting net7

To install a prerelease version of a tool, you need to add the --prerelease option to the install/update command.

@wallymathieu
Copy link
Author

So then this should be categorized as a bug then?

@ajcvickers
Copy link
Contributor

@wallymathieu Can you run both the commands with --verbose output and post the output here?

@wallymathieu
Copy link
Author

dotnet tool restore -v diag
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/index.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/index.json 718ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/0.0.1-alpha/3.1.28.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/0.0.1-alpha/3.1.28.json 205ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/3.1.29/6.0.23.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/3.1.29/6.0.23.json 202ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/6.0.24/8.0.0-rc.2.23480.1.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/6.0.24/8.0.0-rc.2.23480.1.json 197ms
Tool 'dotnet-ef' (version '7.0.5') was restored. Available commands: dotnet-ef

Restore was successful.
dotnet ef database update -v diag
Run "dotnet tool restore" to make the "dotnet-ef" command available.

@ajcvickers
Copy link
Contributor

@wallymathieu Two questions:

  • Can you post your PATH?
  • What happens if you try to use dotnet-ef instead of dotnet ef? (This runs the tool executable directly.)

@wallymathieu
Copy link
Author

dotnet-ef : The term 'dotnet-ef' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\dotnet\
C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\Neovim\bin
C:\Program Files\Kubernetes\Minikube
C:\ProgramData\chocolatey\bin
C:\Program Files\Git\cmd
C:\Program Files\nodejs\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files\Microsoft VS Code\bin
C:\Program Files\Microsoft SQL Server\140\Tools\Binn\
C:\Program Files\TortoiseSVN\bin
C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
C:\Program Files\Microsoft SQL Server\150\DTS\Binn\
C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\
C:\Program Files\Azure Data Studio\bin
C:\Users\oskar\AppData\Local\Microsoft\WindowsApps
C:\Users\oskar\AppData\Local\GitHubDesktop\bin
C:\Users\oskar\.dotnet\tools
C:\Users\oskar\AppData\Roaming\npm
C:\Users\oskar\.dotnet\tools

@ajcvickers
Copy link
Contributor

@bricelam I am now seeing this on my Windows machine, using all the latest versions:

PS C:\local\code\AllTogetherNow\Daily> dotnet tool restore --verbosity diag
[NuGet Manager] [Info]   GET https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/49a1bb2b-12b0-475f-adbd-1560fc76be38/nuget/v3/registrations2-semver2/dotnet-ef/index.json
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/index.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/index.json 209ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/0.0.1-alpha/3.1.28.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/0.0.1-alpha/3.1.28.json 125ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/3.1.29/6.0.23.json
[NuGet Manager] [Info]   OK https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/49a1bb2b-12b0-475f-adbd-1560fc76be38/nuget/v3/registrations2-semver2/dotnet-ef/index.json 396ms
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/3.1.29/6.0.23.json 142ms
[NuGet Manager] [Info]   GET https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/6.0.24/8.0.0-rc.2.23480.1.json
[NuGet Manager] [Info]   OK https://api.nuget.org/v3/registration5-gz-semver2/dotnet-ef/page/6.0.24/8.0.0-rc.2.23480.1.json 131ms
Tool 'dotnet-ef' (version '8.0.0-rtm.23517.11') was restored. Available commands: dotnet-ef

Restore was successful.
PS C:\local\code\AllTogetherNow\Daily> dotnet ef migrations add One --verbose
Run "dotnet tool restore" to make the "dotnet-ef" command available.

@bricelam
Copy link
Contributor

bricelam commented Nov 16, 2023

Looks exactly like dotnet/sdk#11820 (and dotnet/sdk#36847)

@bricelam

This comment was marked as outdated.

@bricelam
Copy link
Contributor

@JL03-Yue Was there a breaking change to the command resolver?

@bricelam

This comment was marked as off-topic.

@JL03-Yue
Copy link
Member

@bricelam There is a major tool change in tool acquisition in .NET 8 GA. I don't think for command resolver though. There is a similar issue that we are working on a fix

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants