in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Project using EF... Installation does not work

Last post 11-09-2008 8:48 AM by Amol. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-05-2008 6:05 PM

    • Amol
    • Top 500 Contributor
    • Joined on 10-08-2008
    • Posts 5

    Project using EF... Installation does not work

    I created a project using entity framework (.net 3.5 SP1) and using sqlite. And then I created a setup project using the Visual studio's wizard, packaging all the standard (primary output, localized resources, dependencies, xml serialisation assemblies). All this works just fine on my machine (both in debug mode in visual studio, and after installing it using the windows generated .msi file)

     But when I take the installer .msi file to a different machine (that also has .net 3.5 sp1 installed), the installation is succesful, but the software won't load. It crashes when I open the exe.

    After some poking around, I found that it is crashing on the line:

    My_Entities myDB= new My_Entities(connection_string);

    Nothing's changed in the source code on my computer and the target computer. The database file on which I am trying to create the entiy connection exists in exactly the same path.

     Do I need to package additional files in the installer?

    Thanks!!

    Amol

  • 11-06-2008 2:51 AM In reply to

    Re: Project using EF... Installation does not work

    Hi there!

    First of all, I'd like to say thanks for the great work on System.Data.SQLite!

    I have the same problem as Amol has.
    On local machine, the app runs fine.
    On any other pc (Where I installed the app via setup project), I get an error message about the not found provider (not present or not installed). Normally, the app would crash like Amols, but I catched the error like this:

    try
                {
                    if (_DB == null)
                    {
                        _DB = new vidlibdbEntities();
                        _DB.SavingChanges += new EventHandler(_DB_SavingChanges);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message, ex.InnerException);
                }

    I used App.config to set the provider:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <connectionStrings>
        <add name="vidlibdbEntities" connectionString="metadata=res://*/vdb.csdl|res://*/vdb.ssdl|res://*/vdb.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=vidlibdb.s3db&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
    </configuration>

    I tried a tool to list all the dlls my app is using locally, there I found links or dependencies to System.Data.SQLite (MSIL) and System.Data.SQLite.linq (MSIL) in C:\Windows\assembly folder.

    That is why the app does not start on any other pc, right?

    Only after installing visual studio sp1 on a virtualpc for testing and registering System.Data.SQLite 1.0.60.0 for designer-support, the app works fine.

    So, what is wrong with our setting?

  • 11-06-2008 5:39 AM In reply to

    Re: Project using EF... Installation does not work

    Ok,

    after re-reading the readme.html (linked on startpage of this website), I got it working with the following App.config:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.data>
        <DbProviderFactories>
          <remove invariant="System.Data.SQLite"/>
          <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
        </DbProviderFactories>
      </system.data>

      <connectionStrings>
        <add name="vidlibdbEntities" connectionString="metadata=res://*/vdb.csdl|res://*/vdb.ssdl|res://*/vdb.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=vidlibdb.s3db&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
    </configuration>

    All seems to be perfect now, the only thing is, that I have to edit the App.config every time a new System.Data.SQLite.dll comes out ;-)

  • 11-09-2008 8:48 AM In reply to

    • Amol
    • Top 500 Contributor
    • Joined on 10-08-2008
    • Posts 5

    Re: Project using EF... Installation does not work

    Thanks !! This worked for me as well.

     

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems