How to use .NET in fuse tools?

Hello!

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 - Test.uno

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
{
	[DotNetType("TestLib.MyClass")]
	extern(DOTNET) public class MyClass
	{
		public extern string TestGet();
	}

	[UXGlobalModule]
	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) {
			Debug.Log("start");
			MyClass myClass = new MyClass();

			return myClass.TestGet();
		}
	}
}

File - MainView.ux

<App>
    <JavaScript File="main.js" />

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

File - main.js

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

var testClick = function (args) {
    console.log('testClick');
    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.