I’m trying to add System.Data.SQLite with EF6 support to my Unity project (targeting .NET 4.x Equivalent). However, when trying to build the connection string, I get the following error:
The type ‘System.Data.Common.DbConnectionStringBuilder’ has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly ‘System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’
When opening the class in Visual Studio, I get the following error on the SQLiteConnectionStringBuilder:
“Module 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” should be referenced
I can add the reference through Visual Studio, but when I return to Unity, the reference gets removed on Unity’s recompile (by design, Unity doesn’t know Visual Studio added a reference in the generated .csproj and it gets overwritten.)
I have tried adding a mcs.rsp file with -r:System.Data.dll
and the error in Unity goes away, but when I open Visual Studio to edit the class, I get the same error and the project’s references don’t show System.Data.dll.
I’m assuming since the error went away in Unity that the mcs.rsp file is doing its job, but why isn’t it reflecting that in Visual Studio? Is there anything else I need to do?