Skip to content

AngxiaoLu123/WebAssemplyDemo

Repository files navigation

WebAssemblyDemo (sorry for the typo in the repo name)

Used 3rd party library

https://github.com/Elringus/DotNetJS

Compile

Install .Net 6. Open command prompt, cd to WebAssemplyDemo\WebAssemblyTest run

dotnet publish

Copy dotnet.d.ts and dotnet.js from WebAssemplyDemo\WebAssemblyTest\WebAssemblyTest\bin to WebAssemplyDemo\src\assets

image

Run

Go to root directory WebAssemplyDemo

Run angular project in the command prompt with ng serve -o Open Console in browser and click test button image

How to expose C# method:

  1. C# project should use Microsoft.NET.Sdk.BlazorWebAssembly sdk and add project reference DotNetJS image

  2. Create a static main entry point, add [JSInvokable] attribute on the method image

  3. Booting dotnet runtime in the index.html image

  4. Invoke method in the angular app.component.ts image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published