Photon3Unity3D.dll Visual Studio "indirect dependency on .Net 4.0"

Guess I must be missing something obvious since I don't see other complaints over this.

I am using Unity 5.3.2f1, Visual Studio 2013 Ultimate, and the Turnbased SDK (not PUN) framework downloaded from https://www.photonengine.com/en/turnbased/download#unity3d

My code builds and runs fine in Unity (authenticates with Photon, joins a lobby etc.) but Visual Studio complains unless I target .Net framework 4.0. If I use the default target framework of "Unity 3.5 .net subset" then it throws a lot of warnings and errors eg:

"The primary reference "Photon3Unity3D" could not be resolved because it has an indirect dependency on the framework assembly "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5".

To resolve this problem, either remove the reference "Photon3Unity3D" or retarget your application to a framework version which contains "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"."



If I switch frameworks in VS everything works fine but obviously I don't really want to do that (and Unity switches me back anyway).

What have I done wrong or how can I fix this (eg. could I use the Photon3Unity3D.dll from PUN which presumably doesn't have this issue but even if that fixes it obviously I shouldn't have to do that).

What's the correct fix?

Comments

  • Ok, I've worked it out I think.

    There are multiple Photon3Unity3D.dll plugins in the assets for different platforms - and even though Unity seems to be managing them correctly in the Inspector window, when it builds the Visual Studio solution it's not including the one I want (it's choosing the WP8 one).

    There could be a better solution but in Unity I'm simply turning off the dll's I don't need so it's now including the correct one in my VS solution.
  • That's the correct way to do. We have to include multiple builds of the dll to support the platforms and in Unity, you can define which dll to use for which platform.

    Maybe our Unity 5 dll setup could use a refresh. It seems more than one dll was available for your platform and things broke.
  • Thank-you!!! This was the exact issue I was having. I have just been setting my VS sln to build in 4.0 and keeping a mental note to stick with 3.5 features.