Upgrading Photon Server from v3 to v4 (assembly loading)

Options
no1no
no1no
edited June 2016 in Photon Server
Continue what we discuss in this thread http://forum.photonengine.com/discussion/7843/photon-server-and-ipv6

In short, I'm forced to upgrade my server code from v3 to v4 so it support IPv6. I copied my code from old server to new server, convert old function to new and clear all the build error. However I got one exception
An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
whenever I run through this line
MyDbEntities db = new MyDbEntities();
This line initialize my EntityFramework context. At first I thought it's my code that have problem but after open a fresh LoadBalancing example and add EF to it and call the exact same line I got the same error again. Any idea why this happen?

Comments

  • no1no
    no1no
    edited June 2016
    Options
    I figured out how to fix this, I have to copy any 3rd party libraries' DLL (Entity Framework, log4net, Newtonsoft.Json,...) to the folder \deploy\bin_Win64 or \deploy\bin_Win32 (depend on what you're using). Adding reference to them in the project is not enough. If you're using Photon plugin you have to do the same too.
  • Markus
    Options
    Hi,
    glad you figured this out. Just to note, this is not related to the Photon upgrade but general .NET behavior of assembly loading/searching.
  • chvetsov
    Options
    no1no said:

    I figured out how to fix this, I have to copy any 3rd party libraries' DLL (Entity Framework, log4net, Newtonsoft.Json,...) to the folder \deploy\bin_Win64 or \deploy\bin_Win32 (depend on what you're using). Adding reference to them in the project is not enough. If you're using Photon plugin you have to do the same too.

    hi, no1no, your solution is NOT really right, although you may do anything on you machine.
    everything what is referenced by plugin should be placed near plugin in same folder

    usually it is Plugins/PluginName/Version/bin or Plugins/PluginName/bin
  • no1no
    Options
    Markus said:

    Hi,
    glad you figured this out. Just to note, this is not related to the Photon upgrade but general .NET behavior of assembly loading/searching.

    It's related to Photon upgrade because the old version (v3) doesn't required 3rd party DLLs to be copy to deploy/bin. If I ran it straight from the solution then I only have to add reference to the DLL in the project. if I run it in release mode then the files only need to be in the respective server bin folder (e.g LoadBalancing/Master, LoadBalancing/GameServer01,02,...).
    chvetsov said:

    no1no said:

    I figured out how to fix this, I have to copy any 3rd party libraries' DLL (Entity Framework, log4net, Newtonsoft.Json,...) to the folder \deploy\bin_Win64 or \deploy\bin_Win32 (depend on what you're using). Adding reference to them in the project is not enough. If you're using Photon plugin you have to do the same too.

    hi, no1no, your solution is NOT really right, although you may do anything on you machine.
    everything what is referenced by plugin should be placed near plugin in same folder

    usually it is Plugins/PluginName/Version/bin or Plugins/PluginName/bin
    Actually I got the same exception as EF but with PhotonHivePlugin and when I copied the the DLL to deploy/bin_ It went away that's why I made the conclusion that the plugin DLL should be copied to the same folder as 3rd party DLL.
  • chvetsov
    Options
    it looks like you set up something wrong. Check TestPlugins for post build steps. or switch plugins off if you do not use them