Entity Framework SQL Script generation failed when publish to a folder

JORGE MALDONADO BARRERA 211 Reputation points
2022-05-30T17:51:44.47+00:00

Hi,

I am developing a ASP.NET 6 web project using Visual Studio 2022 version 17.2.2 (latest). I implemented Identity by myself (not the default razor pages) so there is a EF Context for it. I am trying to publish the project to a folder and the publish profile has the following settings:

206758-capture.jpg

For now, I only hace 1 connection string and 1 context which are shown in the last 2 options (Databases and Entity Framework Migrations). If I do not select both of them, then the project is published successfully. (I manually delete all the files in the destination folder.) However, if I select both of them then I get an error.

In Visual Studio I get the following message:
206764-error-2.jpg

Also, I get the following message:
206804-error.jpg

As you can see, there is a reference to a file named tmpBA62.tmp with the follwoing content:
**5/30/2022 12:13:26 PM
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.

===================
**

I have goggled for an answer but I have not found a solution to my specific case or posts are old.

Additional information about my project is shown below:
206841-packages.jpg

NOTE: I do not use Microsoft SQL Server but PostgreSQL Server with ADO.NET Data Providers from DevArt (dotConnect for PostgreSQL). My project runs fine in my local PC.

I will very much appreciate any comment that helps solve my issue.

Besr regards,
Jorge Maldonado

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,158 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sachin Barthwal 0 Reputation points
    2023-02-07T09:58:48.9966667+00:00

    Use the same version on all packages of EntityFrameworkCore and you are golden.

    0 comments No comments