Error building WP8.1 plugin: namespace does not exist in the current context

Hi,

I’m trying to make a plugin for WP 8.1 (also for W8.1 in the near future) but I’'m having a lot of problems doing it.
I followed the step by step official guide to create plugins in WP8: http://docs.unity3d.com/Manual/wp8-plugins-guide-csharp.html but it seems to be outdated for my plugin which needs to compile in WP8.1.
Unfortunately, there is no such guide for WP8.1, so I tried the following:

  1. Created new Blank Solution in Visual Studio 2013 (Version 12 update 2).
  2. Created new project. Tried class library (universal portable) and class library (Windows Phone) under Apps from store (titles may vary due to my software is not in english).
  3. Created the class with a single test method (public static string testing() { return “OK”; } inside class declaration.
  4. Built solution.
  5. Copied .dll and .pdb files (also .pri file trying to get it working) from /bin/Debug/ to /Asset/Plugins/Metro in Unity (also tryed /Assets/Plugin/Metro/WindowsPhone81) as mentioned in the documentation.
  6. Tried to access the testing function from C# script.
  7. Got this error:
    Assets\Plugins\WP81Test.cs(12,14): error CS0103: The name ‘WP81Test’ does not exist in the current context

It’s getting crazy… please, can someone help me with a solution?

Thanks.

Did you create fake DLL as well? Also there’s a difference between Windows Phone and Windows Phone 8.1, for Windows Phone 8.1 - choose Windows->Windows Apps->Class libraries

I just created the project as you mentioned (didn’t try “Windows Apps” before) and it still doesn’t work.

I also tried to create a fake DLL with the same content as real DLL, only one method: public static string testing() { return “OK”; } The only difference is .NET Framework 3.5 in fake DLL and 4.5 in real DLL.
When I copy the fake DLL into Assets/Plugins folder, Unity throws me an error:
Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies.
File name: ‘System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’
at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType (System.Reflection.Module,string,bool,bool)
at System.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in :0
at System.Reflection.Assembly.GetType (System.String name) [0x00000] in :0
at Mono.CSharp.RootNamespace.GetTypeInAssembly (System.Reflection.Assembly assembly, System.String name) [0x00000] in :0
at Mono.CSharp.RootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in :0
at Mono.CSharp.GlobalRootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in :0
at Mono.CSharp.Namespace.LookupType (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in :0
at Mono.CSharp.Namespace.Lookup (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in :0
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression right_side) [0x00000] in :0
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in :0
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression right_side) [0x00000] in :0
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in :0
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in :0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.Argument.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.Arguments.Resolve (Mono.CSharp.ResolveContext ec, System.Boolean& dynamic) [0x00000] in :0
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in :0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in :0
at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext ec) [0x00000] in :0
at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in :0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in :0
at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in :0

Make sure the fake DLL targets desktop, not Windows Store Apps.

Wow, now it works perfectly, thanks to both of you for guiding me :slight_smile:

SOLVED.