2

I already have an existing Blazor Web Assembly project running perfectly.

Now my target is to run the same code in a MAUI Blazor Hybrid App.

To build this project I've implemented the following project structure:

1- API client
2- WebApp Blazor Client project
3- MAUI app
4- Shared.core.UI
5- Shared.core.Services.

I have two index.html files, the first in the WebApp project and the second in the MAUI app project.

I also added the webview.js script to the index.html in the MAUI app project.

When I run the emulator the app crashes with no error.

Any suggestions please?

I've tried removing the javascript file from the index.html in the MAUI app project.

4
  • We can not know your project only by the words so can you provide some codes? Besides, did you use the debug mode to test the project? Commented Jun 15, 2023 at 7:47
  • Yes i found this error. Uncaught (in promise) TypeError: window.external.receiveMessage is not a function at blazor.webview.js:1:40417 at Object.st [as start] (blazor.webview.js:1:40735) Commented Jun 15, 2023 at 11:22
  • This seems like an issue about JavaScript. You can check the question about Uncaught (in promise): TypeError: myFunction is not a function. Commented Jun 16, 2023 at 6:09
  • what was the fix to thii? Commented Jan 27 at 19:04

2 Answers 2

1

You can try using BitPlatform Templates which allows you to have Blazor WASM, Server, Hybrid and Electron from one code base.

https://bitplatform.dev/todo-template/getting-started

Sign up to request clarification or add additional context in comments.

1 Comment

I can not start my project from scratch I did a lot of work for blazor web assembly.
0

If I've understood your current project architecture correctly, I believe you need to start a new Visual Studio 2022 solution using the '.NET MAUI Blazor hybrid and Web App' template, called 'myawesomeproject'.
If it's not on the list, update Visual Studio.
Copy the code from your old MAUI project to the new 'myawesomeproject' project.
Copy the Shared.core.UI code to the 'myawesomeproject.Shared' project.
Copy the 'WebApp Blazor Client' code to the 'myawesomeproject.Web' project.
Add both the 'API client' and the 'Shared.core.Services' projects to the myawesomeproject solution.

Without knowing the contents of you current projects, this isn't 100% guaranteed, though.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.