When I try to do a publish to azure of my app, visual studio shows the erro bellow:
Generating Entity framework SQL Scripts...
Executing command: dotnet ef migrations script --idempotent --output "C:Usersfelipe.m.santosDesktopEstudomasonwebsrcmasonwebobjReleasenetcoreapp1.0PubTmpEFSQLScriptsmasonweb.Models.masonwebdbContext.sql" --context masonweb.Models.masonwebdbContext
Entity framework SQL Script generation failed
Can you run the command with verbose flag?
I'm not running the command. I just push the right button on the project and click on "publish"




As the publish step just runs bunch of commands only under the hood,
Can you run dotnet ef migrations script --idempotent --context masonweb.Models.masonwebdbContext --verbose from the folder src\masonweb? That would give more insight on why script generation is failing.
Result:

Can you specify a different & valid output path while running command? That directory may not be available if not run as a part of publish step.
I created the folder "EFSQLScripts" and the command executed successfully. I did a test and I was able to publish through visual studio.
I only had one question, despite having deselected the "Apply this migration on publish" option, visual studio still executes this command. Should visual studio not stop running?

@bricelam - For insights on tooling. Do we generate migration script even if we are not applying migrations on publish through publish wizard?
It shouldn't, but you'd have to double check with the team
There are 2 issues here
migrations script fails to execute successfully.Apply this migration on publish is deselected then migrations script is not executed.Assigning to @bricelam to create the folder into which the SQL Script is stored (or to push back if this is something EF shouldn't be doing.)
(We will also need to follow up with Smit's second point, but no issue for that as yet.)
Dupe of #5535 (fixed in 1.0.0-preview4)
@felipemmasan please re-open if you're still seeing this on the latest release of the tooling.
I had the same error recently when trying to publish a .NET Core 2.2 app with VS 2019.
I fixed it by running
dotnet tool install --global dotnet-ef
I'm seeing this error in VS 2019 Community (16.5.3). Haven't had any issues publishing this application until today, having updated VS this morning. The solution suggested by @edgarssults didn't work for me.
Since this release doesn't include any database changes I thought I'd try just disabling EF Migrations in the Publish Profile to get this out. When I did so, the dialog shows this error:

However, on running dotnet tool restore I got the following response:
Cannot find a manifest file.
For a list of locations searched, specify the "-d" option before the tool name.
No tools were restored.
has anyone been able to resolve this
Most helpful comment
I had the same error recently when trying to publish a .NET Core 2.2 app with VS 2019.
I fixed it by running