Deployment during Development can not find a dll and its references

孤街醉人 提交于 2019-12-11 13:12:17

问题


I created a basic plugin and it worked fine when I deploy it for development with:

del "$(ProjectDir)\plugin.xml" "%Ocean2012Home%\PluginPackager.exe" /g "$(TargetPath)" "$(ProjectDir)\plugin.xml" "%Ocean2012Home%\PluginPackager.exe" /mh "$(ProjectDir)\plugin.xml" "%OCEAN2012HOME%\petrel.exe" "$(TargetDir)" 

As the Ocean Dev Guide indicates.

When I try to do something more complex it tells me it can not find one of the dlls and its references. The dll is present where my project is being built. I checked with ProcMon and I could see that Ocean was not checking for the dll in that folder.

I had to force loading the assembly from the specific directory path (using C# - Load Assembly from Specific Directory Path) Doing that my plugin loaded properly. The dll that Petrel is having problems with is InfragisticsWPF.DockManager.dll

I talked with other teams that are working on Petrel and some mentioned to me that since the 2012 version they have to force the LoadAssembly of some of their dlls because Petrel would not find them. Things that worked fine in the 2011 version. Maybe there was some change introduced in 2012 that causes this? Are we missing some configuration?

Update

As requested, this is what the Fusion Log Viewer shows:

For the InfragisticsWPF.DockManager.DLL it tried to access

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable C:\Program Files\Petrel 2012.3\petrel.exe

  • C:/Program Files/Petrel 2012.3/ and a lot of Subdirectories like "Extensions" It looks like it went through all the folders inside C:/Program Files/Petrel 2012.3/
  • It tried searching for InfragisticsWPF.DockManager.EXE too, inside the same folders.
  • All probing URLs attempted and failed.

It never searches in the path where my Plugin is. Although Petrel fails loading InfragisticsWPF.DockManager.DLL it doesn't fail loading any of my other dlls. For my other dlls the log looks just the same but the last attempt checks in the folder where my Plugin is:

LOG: Attempting download of new URL 

file:///c:/myFolder/MyAssembly.DLL.
LOG: Assembly download was successful. Attempting setup of file: c:\myFolder\myAssembly.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: MyAssembly, Version=1.0.0.0, Culture=neutral
LOG: Where-ref bind Codebase does not match what is found in default context. Keep the result in LoadFrom context.
LOG: Binding succeeds. Returns assembly from c:\myFolder\myAssembly.dll.
LOG: Assembly is loaded in LoadFrom load context.

Both dlls are one next to the other, but for some reason Petrel has problems with InfragisticsWPF.DockManager.DLL and not with any of the other dlls present.


回答1:


We were having this same problem for a plugin that has worked. The reason is that installing a plugin using "PluginManager" no longer changes the <probing privatePath="Public;Extensions;..."/> attribute of the file petrel.exe.config. In the old way of installing plugins in Petrel (add module) directory of the plugin was added "probing path", causing the Assembly.LoadFile find such directory.

Write a test ... manually add the plugin's directory in "probing path" and the problem will be solved. Just do not yet know why Schlumberger made ​​this change and if there is a more correct way to do this.




回答2:


Need to add your plugin folder path which is inside the petrel folder in pluginpackager.exe.config



来源:https://stackoverflow.com/questions/16969198/deployment-during-development-can-not-find-a-dll-and-its-references

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!