How can I reference a Blazor Hybrid project’s form or component in WinForms?
I’ve created a Blazor Hybrid project and referenced it in a WinForms project, but the styles are not displaying correctly
this is program.cs
This is my execution result
this my config
https://gist.github.com/SIGEER2222/c9452462a415ce042e323e973558e286
Do I need to configure something, or is it not possible to do this?
3 Replies
Just to clarify: this is just for testing purposes and I have no other intentions. In fact, I plan to use Blazor components in my existing WinForms project.
this my demo https://github.com/SIGEER2222/BlazorWinForms5
GitHub
GitHub - SIGEER2222/BlazorWinForms5
Contribute to SIGEER2222/BlazorWinForms5 development by creating an account on GitHub.
Alright, in my attempt, it is necessary to modify the sdk of .csproj to
<?xml version="1.0" encoding="utf-8"?>\n<Project Sdk="Microsoft.NET.Sdk.Razor">,
and add <ItemGroup><PackageReference Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="6." /><PackageReference Include="Microsoft.Extensions.Hosting" Version="6." /></ItemGroup>
to make it work. I hope my attempt can help others.