Can Add-In include WebAssembly C# code

Gunnar N 1 Reputation point
2021-08-10T14:48:35.303+00:00

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.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,390 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,248 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,489 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,026 Reputation points
    2021-08-10T15:05:01.703+00:00

    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://learn.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://learn.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.

    1 person found this answer helpful.

  2. Craig Callender 1 Reputation point
    2023-01-30T16:58:50.1566667+00:00

    It does look like this has changed since 2021. Here's an official sample of how to do this and it's supported in Windows, Linux, and MacOS (on both Desktop and Web): https://github.com/OfficeDev/Office-Add-in-samples/tree/main/Samples/blazor-add-in/outlook-blazor-add-in

    There are more samples for blazor and other office applications in the tree.

    0 comments No comments