Im using Unity 5.2 and Visual Studio Professional 2013. I use json.net to serialize/deserialize json text into objects. I have to set up the solution to Framework 3.5 to work. But Unity constantly changes the project to Framework 3.5 full base class library, changes the solution target platform to “Any CPU” (I need “x86”), and adds a references of json to the EDITOR project (I just need it on the regular project).
How I prevent Unity to do this?
NOTE: In previous version of UnityVS plugin (where you import in Unity) you can wrote a script for this. But in this versions Microsoft already has the UnityVS integrated in Visual Studio.
Anyone else having this issue?
1. Check import settings
If you are using the json.net DLL, then first check the import settings of it in the Unity editor.
Just navigate to your Plugins folder and check the Selected platforms and Platform settings for the DLL.
Since you say, that the reference is added to the Editor project you should also check, if the DLL is within any Editor folder. Only then the reference is moved to the editor project.
2. Alter the project settings of VS project
Beware this is the complicated but more flexible solution!
You could hook up to the Project File Generation API of Visual Studio Tools for Unity.
But first you should compare your own
*.csproj files (with all the hand-made setting) with the one Unity generates. In the end
*.csproj files are just XMLs, so just open them in a text editor.
I think, you need to adjust some nodes in the
<PropertyGroup> node, namly
<Platform> (for changing the target platform),
<TargetFrameworkProfile> (for the .Net framework settings).