question

GunnarN-8848 avatar image
0 Votes"
GunnarN-8848 asked JadeLiang-MSFT edited

Can Add-In include WebAssembly C# code

I wonder if Add-Ins supports C# WebAssembly / Blazor so I can code in C# and not only java script to develop a more sophisticated Add-in?
If it is, I would like to know how I could use C# for an Add-In in Outlook to then be deployed in Marketplace.

dotnet-csharpoffice-addins-devdotnet-aspnet-core-blazor
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GunnarN-8848,

Considering your issue may be more related to development instead of Outlook desktop client, I would remove Outlook tag under your post, thanks for your understanding.

0 Votes 0 ·

1 Answer

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered BruceBarker-8516 commented

There is no WASM support. WASM is a vm sandbox implemented by the browser. It is currently not implemented by WebView controls used by Windows and MacOs applications. If WASM becomes popular enough, the WebViews may add support. There are requests for Electron to support WASM.

While the office apps could add their own WASM support, WASM apps would not be practical with Online Office (as only one WASM is supported per site). It would make more sense to request direct Blazor support in office apps, but again there is the issue of online apps (but there is a javascript interpreter for WASM which can host blazor code).

While office applications do not officially support blazor, you may be able to get the server version to work. Currently Fluent UI React is the preferred solution:

https://docs.microsoft.com/en-us/office/dev/add-ins/design/using-office-ui-fabric-react

but if you want non react then use fabric core

https://docs.microsoft.com/en-us/office/dev/add-ins/design/fabric-core


note: As WASM has no access to the network or dom except calling JavaScript via messages, I don’t see how it can be more sophisticated.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Could you give an example of javascript interpreter for WASM which can host Blazor code? Especially for an Add-in.
I would strongly like to use Blazor to code C# for Add-Ins for Markeplace.

A former person has asked MS team on their plan to support Blazor: https://blog.codeinside.eu/2020/04/30/blazor-for-office-addins-first-look/
But UserVoice is not supported by MS, so I put my wish and request here to add Blazor support in Add-Ins for online and desktop Office 365 apps.

0 Votes 0 ·

If you look at the blazers JavaScript startup code, you will see it checks for WASM support. If not it uses a JavaScript WASM interpreter. The performance is ok, but not great.

I think trying to use blazor is a bad approach. You can use typescript.

Note: As supporting two blazor addins would be very difficult and not performance in a browser, it’s unlikely to get support anytime soon.

0 Votes 0 ·