【发布时间】:2018-07-06 10:34:31
【问题描述】:
我想在我自己的 DLL 项目中使用 System.Numerics 程序集的某些类,这些类也用于其他一些项目。但是我遇到了针对 UWP Hololens 的 Unity3D 问题。在编辑器中它是开箱即用的,但是当我构建项目时 Unity 抱怨error CS7069: Reference to type 'Vector3' claims it is defined in 'System.Numerics', but it could not be found
我从 Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api 复制了 System.Numerics.Vector.DLL。 4.7.1 应该是根据这个Unity blog post 的那个。我尝试了不同的版本(甚至是 4.5),但它也不起作用。
我自己的 DLL 也使用 4.7.1(一开始尝试使用 4.6.1)。现在编辑抱怨Loading script assembly "Assets/DLLs/System.Numerics.Vectors.dll" failed!。因此我排除了编辑器平台。
接下来我尝试使用 System.Numerics.dll(即不仅仅是向量)。现在结果更奇怪了:CS0433: The type 'Vector3' exists in both 'System.Numerics.Vectors ... System.Numerics.
我自己的 DLL 完全是普通的旧 C#,没什么特别的,没有文件访问权限,...
那么我该怎么做呢?是的,我知道 Unity 中有 Vector3D 类 :) 但我需要构建一个在 Unity 外部使用的 DLL。
更新:
我删除了对 System.Numeric 命名空间类的所有直接调用。现在 UWP 解决方案构建,但有一堆后处理错误:
Reference rewriter: Error: type 'System.Numerics.Vector3' doesn't exist in target framework. It is referenced from ARSceneSerialization.dll at ARSceneSerialization.ARKeyFrame.
我觉得这听起来很糟糕。
【问题讨论】:
-
我在 MonoBleedingEdge\lib\mono\4.5 尝试 4.5 版本?
-
我有并且只是重复它但没有成功:一个 DLL (System.Numerics) 但 _ 存在于两个消息中
-
@Programmer(忘记了上一条消息中的@)我猜这是Unity UWP特有的问题,根本不支持这个平台上的System.Numerics.DLL
-
你能尝试为 Windows 独立构建吗?这次没有UWP,看看有没有问题
-
有趣。我怀疑问题在于您如何构建 DLL。我不完全确定,因为我还没有为 Hololens 进行构建。在构建 dll 之前,添加
C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll对其的引用,但转到 Project > Add Reference > Browse。另外,在MonoBleedingEdge\lib\mono\4.5中添加System.Numerics引用它。现在,尝试构建它。如果仍然出现错误,请从项目中删除System.Numerics和System.Numerics.Vectors,然后重试
标签: c# .net unity3d system.numerics