dotnet/efcore · error · OperationException
The project language '{language}' isn't supported by the bui
Error message
The project language '{language}' isn't supported by the built-in {service} service. You can try looking for an additional NuGet package which supports this language; moving your DbContext type to a C# class library referenced by this project; or manually implementing and registering the design-time service for the programming language. What it means
LanguageBasedSelector.Select found no ILanguageBasedService (e.g. CSharpMigrationsGenerator, CSharpModelGenerator) whose Language matches the project language. EF ships only a C# generator by default; F# and Visual Basic need their own design-time service packages. The default language falls back to 'C#' when none is specified.
Source
Thrown at src/EFCore.Design/Design/Internal/LanguageBasedSelector.cs:64
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected virtual T Select(string? language, IEnumerable<T> services)
{
if (string.IsNullOrEmpty(language))
{
language = "C#";
}
var legacyService = services.LastOrDefault(s => s.Language == null);
if (legacyService != null)
{
return legacyService;
}
var matches = services.Where(s => string.Equals(s.Language, language, StringComparison.OrdinalIgnoreCase)).ToList();
return matches.Count == 0
? throw new OperationException(DesignStrings.NoLanguageService(language, typeof(T).ShortDisplayName()))
: matches.Last();
}
}
View on GitHub (pinned to dbf9771522)
Solutions
- Install the language-specific design-time package for your provider (e.g. the F# EF Core design services NuGet package).
- Move the DbContext to a C# class library and reference it from the F#/VB project, then run dotnet ef from the C# project.
- Implement IDesignTimeServices and register a custom ILanguageBasedService for your language.
- Check that the project's Language is what you expect (inspect the .csproj/.fsproj <Language> element).
Example fix
// before: F# project with only C# design services
dotnet ef migrations add Init // fails
// after: register F# services in a DesignTimeServices file
class FSharpDesignTimeServices : IDesignTimeServices
{
public void ConfigureDesignTimeServices(IServiceCollection services)
=> services.AddSingleton<IMigrationsCodeGenerator, FSharpMigrationsGenerator>();
} Defensive patterns
Strategy: validation
Validate before calling
var supported = designServices.Select(s => s.Language).ToList();
if (!supported.Contains(projectLanguage, StringComparer.OrdinalIgnoreCase))
throw new InvalidOperationException($"Language '{projectLanguage}' unsupported. Supported: {string.Join(", ", supported)}"); Prevention
- For F#/VB projects, install the matching EFCore.*.Design language package.
- Prefer keeping the DbContext in a C# class library.
- If implementing a custom language, register its ILanguageBasedService explicitly.
When it happens
Trigger: A migration/scaffolding operation runs in an F# or VB project whose project language string doesn't match any registered ILanguageBasedService.Language. matches.Count == 0 at line 63 -> throw. Triggered via dotnet ef migrations add / dbcontext scaffold in a non-C# project without the matching EFCore.*.Design package.
Common situations: F# project missing Microsoft.EntityFrameworkCore.SqlServer.Design (F#) or an equivalent language-specific design package; VB project with no VB design services; a custom language selector registering the wrong Language string.
Related errors
- No DbContext named '{name}' was found.
- More than one DbContext named '{name}' was found. Specify wh
- More than one DbContext named '{name}' was found. Specify wh
- Unable to find provider assembly '{assemblyName}'. Ensure th
- Unable to find expected assembly attribute [DesignTimeProvid
AI-assisted analysis of dotnet/efcore@dbf9771522 (2026-08-06).
Data as JSON: /api/errors/519dd0ae36b55d47.
Report an issue: GitHub.