none
EntityFramework 4.2, used to connect to MySQL DB, is not being uploaded to Azure web instance

    Question

  • I have a asp.net C# web application built in VS2010. I am using a MySQL database hosted on Amazon RDS, and Windows Azure to host the cloud service instance. 

    My application is targeting .NET Framework 4.0, and I have installed EntityFramework 4.2 via Nuget package manager. I am using the MySQL Connector .Net v6.9.4. 

    I run it fine on my local PC, the EntityFramework package seems to have been installed correctly. When I publish the project it to Azure, however, the EntityFramework DLL is not located in the 'bin' folder on the Azure VM. I am publishing it via VS2010 by right clicking on the project and choosing 'Publish' from the context menu. 

    In my web.config, I have:

        <dependentAssembly>
            <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
          </dependentAssembly>

    And in the packages.config for the project I am referencing the EF, I have:

        <packages>
          <package id="EntityFramework" version="4.2.0.0" targetFramework="net40" />
        </packages>

    but when I try to run my aplication from the cloud, I get the following error:

        Could not load file or assembly 'EntityFramework, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

    Which is quite obvious that it can't be found as it is not being uploaded, for some reason... Why? I have 'Copy Local' set to true for all references of the EF DLL, so am pretty confused why it's not being uploaded to the web instance. Can anyone think of a reason as to why this is not being uploaded to the Azure instance? Is there something I've missed (which is quite possible, I'm a novice when it comes to web app dev)?

    NOTE: This project previously used MSSQL as the database, was using the same version of EF and always worked. But I've had to migrate it to use MySQL (company decision) and now I am facing this issue.. 

    Monday, December 08, 2014 9:08 AM

Answers