locked
Unable to find assembly 'EntityFramework, Version=6.0.0.0 RRS feed

  • Question

  • Have created a Entity Data Model Database which I have included in my Project. When I run the Xbap (full trusted)  after publishing in my machine, it works fine. But when I run it on another  machine that doesn't have sql server install it comes with the following errr: System.Runtime.Serialization.SerializationException: Unable to find assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral.

    Is there anyway that I could deploy my application in a machine that doesn't have any server installed? I mean connecting directly to the mdf file. 

    Connection sting is

      <connectionStrings>
        <add name="PlutoDBEntities" connectionString="metadata=res://*/HistoryEDM.csdl|res://*/HistoryEDM.ssdl|res://*/HistoryEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\PlutoDB.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>

    As you can see, the provider's name is  System.Data.EntityClient for EDM which is a .NET Framework Data Providers   

    However provider is System.Data.SqlClient which is for sql server. 

    I know I can include localDb as the setup file. But I want to do without installing localDB (if possible)!

    Wednesday, December 10, 2014 10:28 PM

Answers

  • I think this is a separate question, Bopy.

    You should really have marked Magnus response and started a new question.

    No great harm in marking two responses as answer though.

    .

    You would need to use a dbms which does not require any services or install.

    Or a web service to connect to a remote database.

    This might not be a huge change since you can potentially use entity framework with another dbms just by changing the provider dll and connection string.

    Stored procedures would be a bit of a complication but if you just have tables then it ought to be reasonably painless.

    Your likely candidates are sql ce or SQLite.

    MS have rather annoyingly decided to deprecate sql ce and I would probably go with SQLite.

    http://www.sqlite.org/

    https://www.nuget.org/packages/System.Data.SQLite.EF6


    Hope that helps
    Please don't forget to upvote posts which you like and mark those which answer your question.

    Thursday, December 11, 2014 9:13 AM

All replies

  • You must include the EntityFramework.dll assembly when you publish the application. Add a reference to it from your WPF application project and set the Copy Local property of the reference to True in Visual Studio before publishing.

    Please remember to mark helpful posts as answer and/or helpful.

    Wednesday, December 10, 2014 10:35 PM
  • Thanks Magnus for the reply. But I have already included EntityFramework.dll in my references.

    Is it something to do with Public Token. 

    Wednesday, December 10, 2014 10:43 PM
  • I see, you are using LocalDB. This is an execution mode of SQL Server Express targeted to program developers. LocalDB is actually an instance of SQL Server Express that must be installed, i.e. you have install SQL Server Express on the machine.

    I would not recommend using a LocalDB for anything other than development.

    Please remember to mark helpful posts as answer and/or helpful.

    Wednesday, December 10, 2014 11:35 PM
  • Is there any way that I could connect directly to the database file without using LocalDB or any other server? 
    Thursday, December 11, 2014 8:55 AM
  • I think this is a separate question, Bopy.

    You should really have marked Magnus response and started a new question.

    No great harm in marking two responses as answer though.

    .

    You would need to use a dbms which does not require any services or install.

    Or a web service to connect to a remote database.

    This might not be a huge change since you can potentially use entity framework with another dbms just by changing the provider dll and connection string.

    Stored procedures would be a bit of a complication but if you just have tables then it ought to be reasonably painless.

    Your likely candidates are sql ce or SQLite.

    MS have rather annoyingly decided to deprecate sql ce and I would probably go with SQLite.

    http://www.sqlite.org/

    https://www.nuget.org/packages/System.Data.SQLite.EF6


    Hope that helps
    Please don't forget to upvote posts which you like and mark those which answer your question.

    Thursday, December 11, 2014 9:13 AM
  • In my Original question I asked in the second paragraph. 

    Is there anyway that I could deploy my application in a machine that doesn't have any server installed? I mean connecting directly to the mdf file.    

    I already knew that with my configuration (connectionstring referring to locaDB) I was supposed to install localDB on the client's machine that's why I didn't mark Magnus answer as useful/answer. Maybe I didn't write my question clearly. 

    Thanks Andy. 


    Thursday, December 11, 2014 9:57 AM
  • I converted my mdf to db and I modified app.config file as well. Now I am getting the following error

    Unable to cast object of type 'System.Data.SQLite.SQLiteConnection' to type 'System.Data.Entity.Core.EntityClient.EntityConnection'.

    Thursday, December 11, 2014 12:09 PM
  • Other options.

    MS Access is another dbms which doesn't require services.

    Your users could possibly also write reports and stuff in access.

    They wouldn't need a paid copy for your app to read data though.

    .

    There's also Sterling.

    Not so much a database as a persisted object store.

    LINQ friendly.

    That would work so long as your data isn't huge.

    http://sterling.codeplex.com/

    .

    Errrmmmm.

    You could ask them to install a dbms like sql express or localdb separately and then refer to it using (localdb).

    That'll just pick up the default instance of sql server on their machine.

    But you would be relying on them installing it.


    Hope that helps
    Please don't forget to upvote posts which you like and mark those which answer your question.

    Thursday, December 11, 2014 6:03 PM
  • Thanks Andy. I am a bit confused now. Which one do you think is best for entity framework 6 or higher and doesn't require any installation. 

    • Sql Ce 
    • access
    • Sterling

    For Access, does the client require to install it?

    I prefer it to be one that I can connect directly through Visual studio from server explorer

    In visual studio 2012, compact is still there, I read that it's gone in vs 2013 but you can add it using add in. 

    Thursday, December 11, 2014 8:26 PM