I had a Visual Studio solution that was using System.Data.SQLite version 1.0.97. When I used NuGet to update to the latest version (1.0.108), I started getting this warning:
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data.SQLite, Version=1.0.108.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
My solution uses "Any CPU" and I don't want to change it to "x86" just to fix this one problem. Is there anything I can do to fix this?
My solution uses "Any CPU" and I don't want to change it to "x86" just to fix this one problem. Is there anything I can do to fix this?
As Anton in this thread said, System.Data.SQLite
has a dependency on System.Data.SQLite.Core
, which is a is a mixed assembly, i.e. it contains both managed code and native code. Therefore a particular System.Data.SQLite.dll
is either x86
or x64
, but never both architectures.
So Microsoft is just trying to warn you when you state that your project is compatible with "Any CPU" but you have a dependency on a project or .dll assembly that is either x86 or x64. Because you have an x86 dependency, technically your project is therefore not "Any CPU" compatible.
You can edit your project file and add this property group and setting to supresse the warning:
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
And if you are very aware of your solution architecture and you do not need the assembly SQLite.Interop.dll
, you can use "System.Data.SQLite (x86/x64)" to eliminate this warning.
See this thread and this thread for some more details.
Hope this helps.