How to use .NET in fuse tools?


Is it possible write your own .NET library and use in fuse tools?

I have create example and this work great in emulator. But when am trying to deploy on android I got exception (namespace missing or class not found).
Library is very simple just simple MyClass + method TestGet();

//File -

using Fuse;
using Fuse.Scripting;
using Fuse.Reactive.JavaScript;
using Fuse.Scripting.NativeModule;
using Uno.UX;
using Uno;
using Uno.Diagnostics;
using Uno.Compiler.ExportTargetInterop;
using FuseTestLib;

namespace FuseTestLib
	extern(DOTNET) public class MyClass
		public extern string TestGet();

	public class TestCall : NativeModule {

		static readonly TestCall _instance;

		public TestCall () {

			if (_instance != null) return;

			_instance = this;
			Resource.SetGlobalKey(_instance, "TestCall");
			AddMember(new NativeFunction("TestMethod", (NativeCallback)TestMethod));

		public static object TestMethod(Context c, object[] arg) {
			MyClass myClass = new MyClass();

			return myClass.TestGet();

File - MainView.ux

    <JavaScript File="main.js" />

        <Text Value="{data}" />
        <Button Text="Test" Clicked="{testClick}"/>

File - main.js

var myClass = require('TestCall');
var Observable = require("FuseJS/Observable")
var data = Observable('');

var testClick = function (args) {
    data.value = myClass.TestMethod();

module.exports = {
    testClick: testClick,
    data: data

TestLib - C#

using System;
namespace TestLib
	public class MyClass
		public MyClass ()

		public string TestGet() {
			return "TestGet() + XXX";

Hi Jonh,

the extern() statements define what target the code should be run on. When compiling for a given target (DOTNET for local preview, Android and iOS for the mobile ones etc.), only the code for that target is included, everything else is stripped.

So if you have this:

    extern(DOTNET) public class MyClass
        public extern string TestGet();

it is no surprise that you’re getting errors when trying to deploy to Android.