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

Dotnet-ef mismatch causes apply Entity Framework migration fails when publishing an individual web app. #32782

Closed
v-elenafeng opened this issue Jan 11, 2024 · 9 comments
Labels
area-tools closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported regression Servicing-approved type-bug
Milestone

Comments

@v-elenafeng
Copy link

REGRESSION INFO: Worked in: 17.8.4 (Contains runtime 8.0.1).

TESTCASES AFFECTED
[8.0/7.0/6.0] SimpleWebAppWithIndAuth

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.9 Preview 2.1 latest released build, Preview channel
    • Web workload
    • Includes SDK 8.0.100 and runtime 8.0.0

REPRO STEPS

  1. New > ASP.NET Core Web App (Razor Pages) > .NET 8.0 > Individual Accounts
  2. Right click the project > Publish > Azure > Azure App Service (Windows)
  3. After the profile created, go to More actions > Edit, expand "Entity Framework Migration" node

ACTUAL
EF Migrations error: You must install or update .NET to run this application.
image

Workaround 1: Uninstall the dotnet-ef 8.0.1 and install version 8.0.0

dotnet tool uninstall dotnet-ef
dotnet tool install dotnet-ef --version 8.0.0

image

Workaround 2: Install runtime 8.0.1 Separately

EXPECTED
image

@v-elenafeng
Copy link
Author

@ajcvickers This issue can be workaround by installing runtime 8.0.1 or dotnet-ef 8.0.0, but would still like to confirm with you if this is a by design issue as we can wait until the 8.0.1 is plugged into VS 17.9 at the release stage. Any thoughts about this?

@ajcvickers
Copy link
Contributor

@v-elenafeng I'm not aware of any intentional change in design from the EF side here. @bricelam might have made some changes to this before he left the company. Either that, or something changed in the way tools are built.

@BBS-PejoTech
Copy link

same issue on linux, manjaro (arch):

dotnet ef                                                                          
You must install or update .NET to run this application.

App: /home/pejotech/.dotnet/tools/dotnet-ef
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /usr/share/dotnet

The following frameworks were found:
  8.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.1&arch=x64&rid=arch-x64&os=manjaro

dotnet info:

.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.2d90560f

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/8.0.100/

.NET workloads installed:
 Workload version: 8.0.100-manifests.2d90560f
There are no installed workloads to display.

Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  8.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/share/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

it looks like dotnet-ef is looking for runtime 8.0.100 but after the sdk update the runtimes remain at 8.0.0. in dotnet --info at least

@bricelam
Copy link
Contributor

bricelam commented Jan 19, 2024

@bricelam might have made some changes to this

No changes from me. I suspect something either in Arcade or the .NET SDK (PackAsTool related) or EF's build files changed.

Version 8.0.1 of the dotnet-ef.runtimeconfig.json file takes an explicit dependency on 8.0.1:

{
  "runtimeOptions": {
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.1"
    }
}

But version 7.0.15 is correct:

{
  "runtimeOptions": {
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "6.0.0"
    }
}

This may be related to some of @AndriySvyryd's changes around TFMs.

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Jan 19, 2024

Interesting. On main it still uses "8.0.0", while on release/8.0 it's "8.0.1", not "8.0.2" as I would expect if this was a tooling change.

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Jan 19, 2024

So, this is the commit that causes this - 4ab9231
My guess is it's just a blanket increase of the minimum SDK version to ensure that it has the security patches.

@bricelam
Copy link
Contributor

bricelam commented Jan 19, 2024

Hmm, release/6.0 also bumps that, but I don’t think it has the same problem. I don’t see anything in the EF build scripts that have changed around this since release/6.0. 🤷‍♂️

@bricelam
Copy link
Contributor

Ah, might need to take this code out of the servicing branch.

@AndriySvyryd
Copy link
Member

Ah, might need to take this code out of the servicing branch.

Yep, that fixes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tools closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported regression Servicing-approved type-bug
Projects
None yet
Development

No branches or pull requests

5 participants