Reputation: 930
After having problems using the Entity Framework tools nuget package (EntityFrameworkCore.Tools
) in my WINUI 3 solution to generate the model files using the Package Manager Console, I figured I'd try using a new, blank solution to generate the files.
That had the same problem, making me wonder if the approach works with WINUI 3.
The approach I took was:
Created a new project/solution: Blank App, Packaged (WINUI 3 in Desktop)
Added packages EntityFrameworkCore.SqlServer
and EntityFrameworkCore.Tools
Opened the Package Manager Console and set the directory to the project
Used the following in the console (credentials and names made generic):
Scaffold-DbContext "Server=tcp:Server.database.windows.net, 1433;Initial Catalog=ProjectName;User ID=UserID;Password=Password;Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
The project will not build. I get an error shown below. Being a new project, I figure there must be something wrong with the process, even though I've referenced multiple documents and video instructions. Admittedly, some of these were for UWP or Xamarin since the WINUI instructions seem to be scant.
So my question boils down to this: is my process wrong, or is there a different approach for WINUI 3 projects?
Error APPX1101
Payload contains two or more files with the same destination path 'DbManagerTempModel.deps.json'.
Source files:
C:\Users\ebagby\Desktop\Temp\DbManagerTempModel\DbManagerTempModel\obj\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\DbManagerTempModel.deps.json
C:\Users\ebagby\Desktop\Temp\DbManagerTempModel\DbManagerTempModel\bin\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\DbManagerTempModel.deps.jsonDbManagerTempModel
C:\Users\ebagby.nuget\packages\microsoft.windowsappsdk\1.2.220902.1-preview1\buildTransitive\Microsoft.Build.Msix.Packaging.targets 1480
Upvotes: 0
Views: 1365
Reputation: 930
To get past the payload problem, I checked the versions of the packages.
I set EntityFrameworkCore.SqlServer
and EntityFrameworkCore.Tools
to version 6.x to match .NET 6 (they were at version 7.x).
I also updated SDK.BuildTools
and WindowsAppSDK
to the latest stable versions.
Upvotes: 0