With the previous version of Unity (earlier than 5.3.2f1) I solved the losing of the sistem data dll in the projects using the following answer: http://answers.unity3d.com/questions/999080/how-to-fix-losing-systemdatadll-in-project.html But after the unity update, in Visual Studio 2015, I can't find the way to add the following rows without the 'wrong type or namespace' error (line 1) or the 'ProjectFilesGenerator does not exist in the current context' error (line 8). Code (CSharp): using SyntaxTree.VisualStudio.Unity.Bridge ... static ProjectFileHook() { ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => { var document = XDocument.Parse(content); RemoveFileFromProject(document, @"Assets\plugins\System.Data.dll"); RemoveHintPathFromReference(document, "System.Data"); var str = new Utf8StringWriter(); document.Save(str); return str.ToString(); }; } Thank you Luca
What is Code (csharp): static ProjectFileHook if it's a function, where its return type? Also is it inside a class?
Sorry for the mistake, I add all the file I used for solve the losing of the dll. Code (CSharp): #if UNITY_STANDALONE_WIN using System; using System.IO; using System.Linq; using System.Text; using System.Xml.Linq; using UnityEditor; using UnityEngine; using SyntaxTree.VisualStudio.Unity.Bridge; [InitializeOnLoad] public class ProjectFileHook { // necessary for XLinq to save the xml project file in utf8 class Utf8StringWriter : StringWriter { public override Encoding Encoding { get { return Encoding.UTF8; } } } static void ProcessNodesWithIncludeAttribute(XDocument document, string localName, string includeValue, Action<XElement> action) { var nodes = document .Descendants() .Where(p => p.Name.LocalName == localName); foreach (var node in nodes) { var xa = node.Attribute("Include"); if (xa != null && !string.IsNullOrEmpty(xa.Value) && string.Equals(xa.Value, includeValue)) { action(node); } } } // Remove System.Data from project (not from file system so Unity can compile properly) static void RemoveFileFromProject(XDocument document, string fileName) { ProcessNodesWithIncludeAttribute(document, "None", fileName, element => element.Remove()); } // Adjust references, by using the default framework assembly instead of local file (remove the HintPath) static void RemoveHintPathFromReference(XDocument document, string assemblyName) { ProcessNodesWithIncludeAttribute(document, "Reference", assemblyName, element => element.Nodes().Remove()); } static ProjectFileHook() { ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => { var document = XDocument.Parse(content); RemoveFileFromProject(document, @"Assets\plugins\System.Data.dll"); RemoveHintPathFromReference(document, "System.Data"); var str = new Utf8StringWriter(); document.Save(str); return str.ToString(); }; } } #endif With this code I prevent the losing of the System.data.dll from the project in Visual Studio. My OS is Windows 10, and the version of Visual Studio is 2015(free version). The problem is related to the "missing namespace" that the newest version of Unity does not reconize
I just had a similar issue after updating VS 2017 today. The fix: 1. Navigate to your VS folder and find this subfolder e.g. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity 2. Double-click Visual Studio 2017 Tools.unitypackage and import in Unity Hope that helps!
This didn't fix it for me.. any other solutions? FIXED: Never mind.. The issue was that MonoDevelop for whatever reason, could not find the files in the Unity project. So using the Visual Studio unitypackage was fixing it, actually.
Is that included in Visual Studio Code as well? I can't find it in my files. I don't have VS '15 or '17.