SQLite Version Conflict with Revit Add-ins

By Saikat Bhattacharya

Let us assume that a Revit add-in references a SQLite Database (version 1.0.80.0) and the SQLite library files are deployed within the Revit add-in application. Since Revit uses SQLite (version 1.0.60.0) itself and invokes the add-in, it will generate a version conflict during runtime.

InvalidCastException: System.Data.SQLite.SQLiteConnection cannot be cast to [B]System.Data.SQLite.SQLiteConnection. Type A originates from ‘System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139’ in the context ‘Default’ at location ‘C:\Windows\assembly\GAC_64\System.Data.SQLite\1.0.60.0__db937bc2d44ff139\System.Data.SQLite.dll’. Type B originates from ‘System.Data.SQLite, Version=1.0.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139’ in the context ‘Default’ at location ‘C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data.SQLite\v4.0_1.0.80.0__db937bc2d44ff139\System.Data.SQLite.dll’.

How can we resolve this exception?

Here are the two approaches that came up during the internal discussions: 

  • Change the add-in to use 1.0.60 for Revit 2013
  • Or use a different AppDomain for the code that accesses the SQLite database. Since the Revit API communication must be in the standard domain, there will need to be a way to get the needed data across the boundary.

Comments

2 responses to “SQLite Version Conflict with Revit Add-ins”

  1. Does Revit use SQLite as its main database? This would be very helpful information for add-in development. Great blog by the way, very helpful indeed. Regards, Dale

  2. Hi Dale
    Aparently, No. Revit does not use SQLite as its main database. Thats all the info I could get.
    And thanks for the compliments on the blog. It is good to hear that you find the contents useful.
    cheers
    Saikat

Leave a Reply to SaikatCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading