Run a Blazar Server App From a Cpp App with hostfxr

hi,


Let me explain my context to you:

I am currently on a C++ application in which I have an Edge Webview2 component which will allow me to display a beautiful Syncfusion Blazor page.


I want my C++ application to automatically launch the .net server (8.0) and therefore be able to directly display my Blazor pages in Webview2.


My .net server would therefore be integrated into my C++ application and this would be completely transparent for the user

Have you ever done this?


For example using the hostfxr.dll library? I don't just want a run with the dotnet command but to be able to send arguments for example.


thx


1 Reply

AK Arun Kumar Ragu Syncfusion Team November 26, 2024 02:03 PM UTC

Hi Castandet,


Greetings from Syncfusion Support!


We have reviewed your query and noticed that it is not directly related to Syncfusion libraries but rather a general question about integrating the .NET runtime into a C++ application. However, we have validated your requirement and gathered some relevant details to assist you.


You can use the hostfxr.dll library, as documented on MSDN, to programmatically launch a .NET application from a C++ application. This approach eliminates the need to manually run the dotnet command and enables the .NET server to start in the background.


For more information, please refer to the following resources:


https://learn.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting

https://learn.microsoft.com/en-us/microsoft-edge/webview2/


If you have any queries related to Syncfusion libraries, please don’t hesitate to reach out.


Regards,

Arun Kumar R


Loader.
Up arrow icon