5

I have a bundle of C# DLLs that I am trying to wrap with python using the pythonnet library.

I noticed that the DLLs are using Application.StartupPath, which in python's case is where the python.exe is located (as far as I understand). This is problematic for me, since it means that I need to copy all the DLLs to the folder where python is being installed (o/w the DLLs raise an exception). If I understand correctly, Application.StartupPath cannot be modified using the pythonnet library. Also, I do not have any access to the DLLs source code, but I know that they are using Application.StartupPath (because I used dotPeak). Building the DLLs from scratch is not a possibility either, since the build is very complicated and requires lots of dependencies.

I'll be glad if someone can help me understand how I can avoid copying the DLLs folder contents to my python interpreter's path.

misha
  • 777
  • 1
  • 9
  • 21
bgmoshe
  • 61
  • 6
  • To modify the behavior of Application.StartupPath in C#, you can set the AppDomain.BaseDirectory property to the path of your choice. This property returns the base directory that the assembly resolver uses to probe for assemblies. – ghostlegend Mar 28 '23 at 10:48

0 Answers0