question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS Mac, fails to add scaffolding when using mssql. Always tries to add the -sqlite flag

See original GitHub issue

Simple 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:closed
  • Created 8 months ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MSicccommented, Jun 5, 2023

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.

1reaction
deepchoudherycommented, Jan 18, 2023

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found