Problems referencing NetStandard DLL from NetStandard project hosting XAML files

I have very simple setup: VS 2017 (15.5.2) solution with projects created via "Cross-Platform App" template (then, with "Blank App" > ".NET Standard" option). I cannot test iOS at the moment, but the "Welcome to Xamarin.Forms!" label launches on my Android device via both the USB and Xamarin Live Player. UWP launches on local machine (Windows 10, build 16299) also. As far as development tools, everything I have is latest and greatest, I believe.

When the NetStandard project hosting XAML files references another NetStandard library project (so, when both are in the same VS solution), the former has no problems using the latter ("MyTestLib").

**But, when I reference the DLL that the latter compiles to (by browsing to it, which will be the real-life scenario in my case), then I get an error when the same code executes:
**
NInterpret.NInterpretException: Assembly MyTestLib is not loaded
at [email protected][b].Invoke (System.String m) [0x00007] in <5a1067f17eef0f2aa7450383f167105a>:0
at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv1[TResult].Finalize () [0x00012] in <55b16819904cf4daa74503831968b155>:0 at [email protected][TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc2[T,TResult] env, A a) [0x00038] in <55b16819904cf4daa74503831968b155>:0
at [email protected][T2,TResult,T1].Invoke (T2 u) [0x00001] in <55b16819904cf4daa74503831968b155>:0
at NInterpret.Interpreter.getAsm (System.String name) [0x0003d] in <5a1067f17eef0f2aa7450383f167105a>:0
at NInterpret.Interpreter.getAType (System.Collections.Generic.Dictionary2[TKey,TValue] gargs, Mono.Cecil.TypeReference cecilType) [0x00067] in <5a1067f17eef0f2aa7450383f167105a>:0 at NInterpret.Interpreter.newobj (System.Collections.Generic.Dictionary2[TKey,TValue] gargs, Mo
no.Cecil.MethodReference m, System.Object[] createInstanceArgs) [0x00009] in <5a1067f17eef0f2aa7450383f167105a>:0
at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet1[T] inTries, Microsoft.FSharp.Core.FSharpOption1[T] lastException) [0x03d60] in <5a1067f17eef0f2aa7450383f167105a>:0
at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet1[T] inTries, Microsoft.FSharp.Core.FSharpOption1[T] lastException) [0x00141] in <5a1067f17eef0f2aa7450383f167105a>:0 "

What am I doing wrong? This is all that "MyTestLib" contains:

namespace MyTestLib
{
public class Class1
{
public string test()
{
return "hi";
}
}
}

The execution fails when the constructor of Class1 is invoked. When projects are compiled, I see the DLL in issue in "bin" folders of all involved projects (including Android project), but I can't know what gets shipped to the device (it looks like this DLL doesn't get transposed over there). I'm new to all this, so I can't be certain which Android-project settings could be relevant.

**Again, this DLL gets to be around on the target device when I reference its project directly.

UWP app deployed to local machine also works with this DLL referenced directly.**

Thank you.

Tagged:

Answers

  • Hari-LubovacHari-Lubovac USMember ✭✭

    Correction :)

    I previously said that the netstandard-dll referencing did **not ** work on Android device deployed to over USB. I must have confused something, because this setup does work over USB connection.

    However, it still does not work with Live Player. So, could it be that I'm missing some code/compilation optimization that Live Player expects?

Sign In or Register to comment.