Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

Move C# scripts to DLLs targeting UWP/Net deployment: the type or namespace 'SerializeAttribute/Serializable' could not be found?

$
0
0
I created some C# code for one of my Unity 5.4.0-f3HTP projects (developing on Win10, x64). This code "lives" in the Assets folder of the Unity project. I wrote the code so that the project can be deployed to HoloLens/UWP, and other platforms (of which only Windows/Osx are used). The C# code depends on access to code that lives in the UnityEngine namespace, the System.* namespace, and the Microsoft.* (for the UWP platform specific backend) namespace. **My goal is to take the C# code out of the assets folder, and use visual studio 2015 to compile it into two platform specific DLL's**. One that is .net 3.5 (for Windows/OSX), the other is for UWP. The .net 3.5 DLL is not a problem. I can't figure out how to set up VS2015 to compile the UWP DLL though. If I compile a "hello world" UWP dll (referencing Microsoft.NETCore.UniversalWindowsPlatform), things work just fine (including referencing the UnityEngine.dll from "C:\Program Files\Unity HoloLens 5.4.0f3-HTP\Editor\Data\Managed\UnityEngine.dll"). But as soon as I add code from the Assets folder, I get a number of errors: *Error CS0246 The type or namespace name 'SerializableAttribute' could not be found (are you missing a using directive or an assembly reference?) Error CS0246 The type or namespace name 'Serializable' could not be found (are you missing a using directive or an assembly reference?)* Note that I am not making any changes to the code as I move it from the Assets folder; and I am setting up the appropriate preprocessor defines for the UWP/Mono backend. I've tried several things to mitigate the problem, including splitting the code into two DLLs; one containing generic code that only depends on .NET and/or UnityEngine.dll, another that has platform specific code for either .NET or UnityEngine - but that did not work (I think I could not add the DLL containing the generic code as a reference to the UWP DLL). So I gave up on exploring this potential solution (but I'm still not sure if I did something wrong vs. it not being possible to do what I envisioned) Has anyone encountered this before?

Viewing all articles
Browse latest Browse all 706

Trending Articles