VS Mac, fails to add scaffolding when using mssql. Always tries to add the -sqlite flag
See original GitHub issueSimple API project based off starting project. Added EF and DB connection. I can add Controller manually and everything works fine but when I attempt to “Add Scaffolding” It always tries to add the '-sqlite" flag to the end of the command and thus failing. Is there a way to stop this because my project is using mssql?
Include stack traces
Building project…
Running /Users.../HotelListing.API/HotelListing.API/obj/dotnet-aspnet-codegenerator --configuration "Debug" --project "/Users.../HotelListing.API/HotelListing.API/HotelListing.API.csproj" controller --model Hotel --dataContext HotelListingDbContext -name HotelsController --no-build -outDir "/Users.../HotelListing.API/HotelListing.API" --controllerNamespace HotelListing.API --restWithNoViews --useSqlite
Finding the generator 'controller'...
Running the generator 'controller'...
Specify --help for a list of available options and commands.
Unrecognized option '--useSqlite'
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.HandleUnexpectedArg(CommandLineApplication command, String[] args, Int32 index, String argTypeName, Boolean ignoreContinueAfterUnexpectedArg)
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:02.66
Unrecognized option '--useSqlite'
Include provider and version information
Microsoft.VisualStudio.Web.CodeGeneration.Design/Microsoft.DotNet.MSIdentity version: Target framework: .NET 7.0 Operating system: MAC IDE: Visual Studio 17.4.2 (build 17)
Issue Analytics
- State:
- Created 8 months ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Error while trying to scaffold a model Visual Studio for Mac
Try to install this package. dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Tools --version 2.0.4.
Read more >Add support to scaffold using Sqlite · Issue #1231
We need this support to get scaffolding to work correctly in Visual Studio for Mac. Currently when a user scaffolds an using EF...
Read more >Getting error while scaffolding - Microsoft Q&A
'Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerSqlTranslatingExpressionVisitorFactory' from assembly 'Microsoft.
Read more >Error with Scaffolding datamodel for Asp.Net
I added Asp.Net MVC, then simple Datamodel class library with EF Core and scaffolded Northwind DB. Then I clicked on Controller, add ->...
Read more >Generating a model from an existing database
Add the Entity Framework Core and Tools packages to the project: ... You use the DbContext Scaffold command to generate the model.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
very strange, because if I choose Razor Pages with Entity Framework, I do not have these Problems…
But I understand, you can’t fix this here. Will open a ticket for VS Mac.
Hey @mrward, I was unaware of mssql support for VS Mac if the Program.cs/Startup.cs is configured for mssql as in @chevol’s case, the scaffolding will fail to activate the DbContext since it will be looking for a
UseSqlite
call which is missing. I’ll take a deeper look today @mrward and we’ll service this ASAP, apologies.