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

API Scaffolding Fails for ASP.Net Core Api Controller #2729

Open
johnholliday opened this issue May 6, 2024 · 0 comments
Open

API Scaffolding Fails for ASP.Net Core Api Controller #2729

johnholliday opened this issue May 6, 2024 · 0 comments

Comments

@johnholliday
Copy link

johnholliday commented May 6, 2024

  1. Create an Asp.Net Core WebApi project
  2. Add a Resources file (SampleProject.WebApi.Properties.Resources.resx).
  3. Add a text file to the Resources.resx file.
  4. Add an EntityFrameworkCore SQL DbContext 'SampleDbContext' with a 'Client' Entity
  5. Run the Controller scaffolding tool
  6. Select 'SampleDbContext' and 'Client' entity for a 'ClientsController'
Error

There was an error running the selected code generator: 
'Could not find the resource "SampleProject.WebApi.Properties.Resources.resources" among the resources "" embedded in the assembly "SampleProject.WebApi", nor among the resources in any satellite assembles for the specified culture.  
Perhaps the resources were embedded with an incorrect name.'

 at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)

 at Microsoft.EntityFrameworkCore.Design.DbContextActivator.CreateInstance(Type contextType, Assembly startupAssembly, IOperationReportHandler reportHandler, String[] args)
 at Microsoft.EntityFrameworkCore.Design.DbContextActivator.CreateInstance(Type contextType, Assembly startupAssembly, IOperationReportHandler reportHandler)
 at Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.EntityFrameworkModelProcessor.TryCreateContextUsingAppCode(Type dbContextType, Type startupType)

Include provider and version information

Target framework: .NET 8.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.9.6

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

1 participant