C
C#13mo ago
Sigeer

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?
Gist
gist:c9452462a415ce042e323e973558e286
GitHub Gist: instantly share code, notes, and snippets.
No description
No description
No description
No description
3 Replies
Sigeer
SigeerOP13mo ago
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.
Sigeer
SigeerOP13mo ago
GitHub
GitHub - SIGEER2222/BlazorWinForms5
Contribute to SIGEER2222/BlazorWinForms5 development by creating an account on GitHub.
Sigeer
SigeerOP13mo ago
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.

Did you find this page helpful?