You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously I have used different patterns to make Add-Migration works. Design-Time factory works fine for me in WinUI3.
but later on we added GenericHost to our WinUI3 app.
I've tried to remove these Design-Time factories and follow Application Service pattern. because it works with my configurations while Design-Time factory doesn't. So I don't needed to hard-code my ConnectionStrings in the code base.
But I'm getting this error when I'm running Add-Migration:
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing
without the application service provider. Error: Unable to load DLL 'Microsoft.ui.xaml.dll'
or one of its dependencies: The specified module could not be found. (0x8007007E)
Unable to create an object of type 'BusinessDomainContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
I have added new Program.cs file. with this content:
public static void Main(string[] args)
=> CreateHostBuilder(args).Build().Run();
// EF Core uses this method at design time to access the DbContext
public static IHostBuilder CreateHostBuilder(string[] args)
=> Host.CreateDefaultBuilder(args).ConfigureServices(services=>
{
services.AddDbContext<BusinessDomainContext>(options =>
{
options.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=aa.BusinessDomain;Integrated Security=True;MultipleActiveResultSets=true;");
});
});
For me, I looks terrific, But it works.
There is an open Issue for this which is open from 2022. and the thing I've done looks bad. I think Microsoft should release WinUI3 in compatible form. I should not re-invent things to getting it to work.
The text was updated successfully, but these errors were encountered:
Previously I have used different patterns to make
Add-Migration
works.Design-Time
factory works fine for me inWinUI3
.but later on we added
GenericHost
to ourWinUI3
app.I've tried to remove these
Design-Time
factories and followApplication Service
pattern. because it works with my configurations whileDesign-Time
factory doesn't. So I don't needed to hard-code myConnectionStrings
in the code base.But I'm getting this error when I'm running
Add-Migration
:here is my command:
I don't understand the source of this problem.
At the next step I've tried to add below config to my
*.csproj
. Error got solved:But Nothing happened after that.
Using
--verbose
I've got this logs:At the next step I have tried to
DISABLE_XAML_GENERATED_MAIN
by updating*.csproj
file.I have added new
Program.cs
file. with this content:For me, I looks terrific, But it works.
There is an open Issue for this which is open from 2022. and the thing I've done looks bad. I think
Microsoft
should releaseWinUI3
in compatible form. I should not re-invent things to getting it to work.The text was updated successfully, but these errors were encountered: