Search code examples
c#.netmacosentity-framework.net-core

Running EF migrations for .NET Framework 4.8 project on Mac using Rider - Missing Microsoft.WebApplication.targets


I'm trying to run Entity Framework migrations on a .NET Framework 4.8 project using JetBrains Rider on macOS. When I try to run the migration using the dotnet ef database update command, I get the following error:

error MSB4019: The imported project "/usr/local/share/dotnet/sdk/9.0.101/Microsoft/VisualStudio/v17.0/WebApplications/Microsoft.WebApplication.targets" was not found.

Environment:

Operating System: macOS
IDE: JetBrains Rider
Project Type: .NET Framework 4.8
Command Used: dotnet ef database update

Full Error Message:

/Users/adam/Projects/project1/project1/project1.csproj(4597,3): error MSB4019: The imported project "/usr/local/share/dotnet/sdk/9.0.101/Microsoft/VisualStudio/v17.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "/usr/local/share/dotnet/sdk/9.0.101/Microsoft/VisualStudio/v17.0/WebApplications/Microsoft.WebApplication.targets" is correct, and that the file exists on disk. Unable to retrieve project metadata. Ensure it's an SDK-style project.

What I'm trying to achieve: I need to run Entity Framework migrations on my .NET Framework 4.8 project on macOS. I'm used to running dotnet ef database update on Windows, but this doesn't seem to work on Mac.

Questions:

  1. Is it possible to run EF migrations for a .NET Framework 4.8 project on macOS?
  2. If yes, what's the correct approach to run migrations using Rider on Mac?
  3. Are there any specific tools or packages I need to install?

What I've tried:

  1. Running dotnet ef database update from the terminal
  2. Using the latest version of Entity Framework tools

Any help or guidance would be greatly appreciated!


Solution

  • No, my friend, you cannot run .NET Framework 4.8 on macOS because .NET Framework is not cross-platform like .NET Core or its later versions, now commercially known as .NET 5 through .NET 9. If you want to run .NET on a Mac, you'll need to upgrade your solution to .NET Core or a newer version of .NET