Entity Framework 6 Package Manager Error - Unrecognized command or argument 'C#'
vsfeedback opened this issue · comments
This issue has been moved from a ticket on Developer Community.
[regression] [worked-in:17.7]
After downloading the latest update to Visual Studio (17.7.1), when attempting to run any EF package manager commands against a database am receiving the following error:
Unrecognized command or argument 'C#'
A review of the output shows that there is, indeed, an extra C# symbol in the script being generated (I have removed sensitive connection information from the string):
C:\Users\dev\Repos\eSMS\packages\EntityFramework.6.4.4\tools\net45\any\ef6.exe database update --connection-string "data source=tcp:(server),1433;initial catalog=(data); MultipleActiveResultSets=True; App=EntityFramework; Encrypt=True; TrustServerCertificate=True;Integrated Security=true;" --connection-provider System.Data.SqlClient --verbose --no-color --prefix-output --assembly C:\Users\dev\Repos\eSMS\Az.Eller.eSMS.Models\bin\Debug\Az.Eller.eSMS.Models.dll --project-dir C:\Users\dev\Repos\eSMS\Az.Eller.eSMS.Models\ --language C# C# --root-namespace Az.Eller.eSMS.Models --config C:\Users\dev\Repos\eSMS\Az.Eller.eSMS.Models\App.config
After confirming with a colleague using an older version of Visual Studio (17.5), this is what is normally emitted
C:\Users\dev\Repos\eSMS\packages\EntityFramework.6.4.4\tools\net45\any\ef6.exe database update --connection-string "data source=tcp:(server),1433;initial catalog=(data); MultipleActiveResultSets=True; App=EntityFramework; Encrypt=True; TrustServerCertificate=True;Integrated Security=true;" --connection-provider System.Data.SqlClient --verbose --no-color --prefix-output --assembly C:\Users\dev\Repos\eSMS\Az.Eller.eSMS.Models\bin\Debug\Az.Eller.eSMS.Models.dll --project-dir C:\Users\dev\Repos\eSMS\Az.Eller.eSMS.Models\ --language C# --root-namespace Az.Eller.eSMS.Models --config C:\Users\dev\Repos\eSMS\Az.Eller.eSMS.Models\App.config
I have done the following:
-- Cleaned and rebuilt all projects in the solution
-- Removed and reloaded all Nuget Packages
-- Uninstalled and reinstalled Visual Studio
After a clean reinstall of Visual Studio, EF commands work as expected after the first launch. Subsequent launches of Visual Studio throw the error.
Currently running:
Edition Windows 11 Enterprise
Version 22H2
Installed on 8/17/2023
OS build 22621.2134
Experience Windows Feature Experience Pack 1000.22659.1000.0
Visual Studio:
Microsoft Visual Studio Professional 2022
Version 17.7.1
VisualStudio.17.Release/17.7.1+34009.444
Microsoft .NET Framework
Version 4.8.09032
Installed Version: Professional
Visual C++ 2022 00476-80000-00000-AA493
Microsoft Visual C++ 2022
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASA Service Provider 1.0
ASP.NET and Web Tools 17.7.266.26423
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.7.266.26423
Azure App Service Tools v3.0.0
Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 17.7.266.26423
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 4.7.0-3.23403.2+09841218a495cafad75ba163350d1e8949d8e5d6
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.4.34 (main@d5ab18b)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query
Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.7.27 (547ea6f)
Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.5.50628.1 Commit Hash:f9e713b25f69afd3ced63d934e0722003b73c121
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 6.7.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Office Developer Tools for Visual Studio 17.6.33921.00
Microsoft Office Developer Tools for Visual Studio
Progress Telerik UI for ASP.NET Core Extension 2023.2.809.64
Progress® Telerik® UI for ASP.NET Core Extension
Progress Telerik UI for ASP.NET MVC Extension 2023.2.809.64
Progress® Telerik® UI for ASP.NET MVC Extension
Progress Telerik UI for Xamarin Extension 2023.2.809.64
Progress® Telerik® UI for Xamarin Extension
Razor (ASP.NET Core) 17.7.3.2333001+0ab18affdf2a37647768d0e25f5f021bee6257a1
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.7.9.2
Microsoft SQL Server Data Tools
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 17.0.20628.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.7.0-3.23403.2+09841218a495cafad75ba163350d1e8949d8e5d6
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.7.0-beta.23314.10+e612cf93b989503c89e3a5830090062b7ab5e143
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 17.7.0.215 (d17-7@30b1e9b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.7.3.9 (remotes/origin/d17-7@796d191def)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.7.21 (150ec9f)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.2.1.2 (d17-5/a8a26c7)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d
Xamarin.iOS and Xamarin.Mac SDK 16.4.0.5 (191fe02ea)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Original Comments
Feedback Bot on 8/22/2023, 04:14 AM:
(private comment, text removed)
Original Solutions
Kevin Ritchie solved on 8/25/2023, 02:18 PM, 0 votes:
There is a way to get around this until a fix is released and won’t require a reinstall of Visual Studio.
If you run your commands in Verbose mode from the PMC e.g. Add-Migration “Name of Amendment” --verbose, you will see that for the --language parameter, C# is being output twice.
You can copy that string out and then remove the second C# from the language parameter, paste it back into the PMC and run it.
It will then create your migration script. Note, you may need to manually add the migration script to the Migrations folder in your solution via Add->Existing Item and select the 3 files that make up the migration script.
To update the database, run Update-Database --verbose, copy out the string as above and remove the second C# and then paste back into the PMC and run.
This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which means we will only make changes to address security issues. See the repo README for more information.