SonyWWS / ATF

Authoring Tools Framework (ATF) is a set of C#/.NET components for making tools on Windows. ATF has been in continuous development in Sony Computer Entertainment's (SCE) Worldwide Studios central tools group since early 2005. ATF has been used by most SCE first party studios to make many custom tools such as Naughty Dog’s level editor and shader editor for The Last of Us, Guerrilla Games’ sequence editor for Killzone games (including the Killzone: Shadow Fall PS4 launch title), an animation blending tool at Santa Monica Studio, a level editor at Bend Studio, a visual state machine editor for Quantic Dream, sound editing tools, and many others.
Apache License 2.0
1.89k stars 262 forks source link

Use other DLL in MEF, throw exception when load the assemblies. #42

Closed xiaominzi closed 7 years ago

xiaominzi commented 8 years ago

error.description:

Fail to load file or assemblies “WeifenLuo.WinFormsUI.Docking, Version=2.3.2.0, Culture=neutral, PublicKeyToken=null” or one of it's dependencies.The definition of the assemblies we found didn't match with the assemblies reference. Exception came from HRESULT:0x80131040

My experiment :

I use VS2010, got dockpanelsuite 2.9.0.0(why the version in exception is 2.3.2.0) by "nuget". I also tried generated dockpanel 2.5/2.6/2.7 DLL by meself, but I can't solved this exception! (It has no dependency according to the explanation in NuGet)

Wanted

Is there anybody who has suffered this or similar exception? Thanks for your experience !

Ron2 commented 8 years ago

It looks like Visual Studio is finding the wrong version of WeifenLuo.WinFormsUI.Docking.dll. We have made a small number of custom modifications to our copy of the DockPanelSuite source code over the years, and so the ATF project file, Atf.Gui.WinForms.vs2010.csproj, really requires the version of DockPanelSuite that we ship in our ThirdParty directory.

Here are some things to try:

  1. Make sure that in your ATF directory, that \ThirdParty\DockPanelSuite\WeifenLuo.WinFormsUI.Docking.dll is really version 2.3.2.0. Also, you unfortunately can't substitute your own compiled version, because our version is a little bit different.
  2. Make sure that the DLL that is referenced by Atf.Gui.WinForms.vs2010.csproj is resolved to the correct version. You can do this by using the Solution Explorer in Visual Studio to look at the Atf.Gui.WinForms.vs2010 project, and then opening the References folder, and then selecting the WeifenLuo reference and then looking at its properties. The "Resolved" property should be True and the Version property should be 2.3.2.0.
  3. Try setting the Specific Version property of the WeifenLuo dll reference to be True. This should prevent the compiler from grabbing the wrong version.
  4. When compiling, the WeifenLuo dll needs to be copied to the output directory. (The "Copy Local" property is set to True on the WeifenLuo dll reference.) If you are referencing a different version of WeifenLuo somewhere else, perhaps the 2.3.2.0 version is being written over. You can check your output directory to make sure that the WeifenLuo dll that is being used at run-time really is 2.3.2.0.

If you're still stuck, you can make sure that you can compile and run the ATF sample apps, like CircuitEditor. Assuming that works, then there must be a problem or conflict with your project settings.

Please let me know how you fix this.

xiaominzi commented 8 years ago

Thanks for your recommendation !
I solved this exception by using \ThirdParty\DockPanelSuite\WeifenLuo.WinFormsUI.Docking.dll instead of the version 2.9.0.0 I got from nuget !
I want to create three forms inherited from "WeifenLuo.WinFormsUI.Docking.DockContent". I add a dockpanel(2.3.2.0) from toolbox to MainForm ! While when the form DockTo(myPanel, DockStyle.Fill) , this can't work normally like this:
exception

I am learning other samples to find the right way to create a standard "dockForm". Maybe I should implements IControlHostClient and register my own control.

I implements IControlHostClient and register my own control. And it works!

Also, the problem showed in the picture was called by adding a form into a panel. It need to set the form's topLevel = false, and call the form's own Show() function after the controlHostService call the Show(control) function!

key Codesnap


    Form1.TopLevel = false;
    Form1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    m_controlHostService.RegisterControl( control, controlinfo, hostclient);
    m_controlHostService.Show(control );
    Form1.Show();