efcore
efcore copied to clipboard
Error: Script-Migration -Idempotent -Context "MyDbContext" -StartupProject "MyStartupProject" -Project "MyDataProject"
Script-Migration : Error HRESULT E_FAIL has been returned from a call to a COM component. At line:1 char:1
- Script-Migration -Idempotent -Context "AoaDbContext" -StartupProject ...
-
+ CategoryInfo : OperationStopped: (:) [Script-Migration], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Script-Migration
happening with VS 2022 17.9.0
I had to revert to using the dotnet cli ef core tools to generate my script. Does seem like an issue with Visual Studio.
dotnet cli ef core tools to generate my script
Thanks Justin, I also tried and dotnet cli ef core tools did generate the script. Here is the command: dotnet ef migrations script --idempotent --context "MyDbContext" --startup-project "MyStartupProject" --project "MyDataProject"
Same issue on VS 2022 17.9.0
This bug also affects VS 2022 17.10 Preview 1.
This issue appears to be the same as this one below, which is that .sql files cannot be viewed in Visual Studio. I'd use the CLI version above to workaround this for now.
https://developercommunity.visualstudio.com/t/sql-Files-cannot-be-opened/10584835 https://developercommunity.visualstudio.com/t/open-sql-in-visaul-studio-after-upgrade/10584421
I'm getting this problem in the latest preview and the normal release of Visual Studio.
Same issue here as above on latest VS 2022
I have found that if you change the application that is used to open an SQL file in Visual Studio, it solves the problem.
I have found that if you change the application that is used to open an SQL file in Visual Studio, it solves the problem.
How can that be done?
I have found that if you change the application that is used to open an SQL file in Visual Studio, it solves the problem.
How can that be done?
I found a way to set a default sql viewer by following the accepted answer here: https://stackoverflow.com/questions/2193083/visual-studio-open-a-sql-file-with-sql-management-studio-in-an-existing-ssms-w
I experienced the same issue, the latest vs release mentions a similar Developer Community problem:
I've since updated to VS 17.9.1 and scripting migrations is working again.
Yeah, it works after the latest 17.9.1 update.