Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lohrion · Jul 03, 2015 at 12:11 AM · c#editordllsql

How to fix losing System.Data.dll in Project?

I am trying to add a database connection to my server application, and need to have a reference to System.Data.dll for that. Everything is fine when I add the reference manually.

However, everytime Unity rebuilds the project and Visual Studio 2013 prompts me to reload the project, the System.Data.dll-Reference is there, but with an exclamation mark, meaning it could not be loaded. Looking at the properties of the corrupt reference, the path is empty.

The System.Data.dll is already in the Assets/Plugins/-Folder.

How can I fix this?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image starikcetin · Jul 03, 2015 at 01:36 AM 0
Share

Are your script and DLL in same folder?

avatar image incorrect · Jul 03, 2015 at 02:28 AM 0
Share

@s.ta.c. They don't need to be in the same folder.

avatar image incorrect · Jul 03, 2015 at 02:34 AM 0
Share

@Lohrion, have you seen this? http://answers.unity3d.com/questions/379212/how-to-solve-the-error-type-or-namespace-systemdat.html

avatar image incorrect · Jul 03, 2015 at 02:37 AM 0
Share

And this one: http://forum.unity3d.com/threads/missing-c-references-to-system-data.11361/#post-82023

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Lohrion · Jul 03, 2015 at 12:43 PM

Thank you @incorrect, your second comment actually brought me on the right track. The last post in that thread refers to this page, where this problem is solved (but if I interpret it correctly, they will not fix this as it is not a bug). If you want, you can just repost this as an answer and I will delete mine and accept yours :)

Basically, you need to add the following code in your Assets/Plugins/Editor folder. You can also modify it to work with other DLLs.

 using System;
 using System.IO;
 using System.Linq;
 using System.Text;
 using System.Xml.Linq;
 using SyntaxTree.VisualStudio.Unity.Bridge;
 using UnityEditor;
 
 namespace Assets.Plugins.Editor
 {
     [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\System.Data.dll");
                 RemoveHintPathFromReference(document, "System.Data");
 
                 var str = new Utf8StringWriter();
                 document.Save(str);
 
                 return str.ToString();
             };
         }
     }
 }

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DDeathlonger · Sep 04, 2018 at 02:52 AM 0
Share

Didn't work for me.. am I missing something..?? I updated the string path to be the correct path...

avatar image
0

Answer by walidabazo · Oct 01, 2017 at 07:02 PM

You can show this videos to connect unity 3d and sqlite and solved all dll error compile for different windows 32bit and 64bit

https://youtu.be/CtDSQkLdlZg

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Creating Scenes Programmatically From A Deployed Build in Unity 1 Answer

Why does Assembly-CSharp reference UnityEditor.dll 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges