Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MONO_PATH when running C# executables under Linux or MacOS #8643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

steffen-kiess
Copy link

C# executables do not have an rpath. Therefore, when building custom
targets or running tests, MONO_PATH has to be set on Linux or MacOS to
make sure that libraries are found. Under windows this is achieved by
setting PATH (which is used for binaries, native libraries and C#
libraries).

@lgtm-com
Copy link

lgtm-com bot commented Apr 12, 2021

This pull request introduces 1 alert when merging 153261c into 50cf8bc - view on LGTM.com

new alerts:

  • 1 for Unused local variable

C# executables do not have an rpath. Therefore, when building custom
targets or running tests, MONO_PATH has to be set on Linux or MacOS to
make sure that libraries are found. Under windows this is achieved by
setting DEVPATH. Note that on windows DEVPATH is only used when the
application config file sets developmentMode to true.
@steffen-kiess
Copy link
Author

I've pushed an updated version which should also work on Windows. Note that on Windows it sets the DEVPATH environment variable and will only work with an application config file like this:

<configuration>
  <runtime>
    <developmentMode developerInstallation="true"/>
  </runtime>
</configuration>

(See https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/developmentmode-element.)

I'm not sure whether there is any better alternative on windows. Other possibilities would be to automatically create a application config with either:

<configuration>  
   <runtime>  
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
         <probing privatePath="some/path"/>  
      </assemblyBinding>  
   </runtime>  
</configuration>  

or:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="libb" />
        <codeBase href="some/path/libb.dll" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

but both solutions will only work if the libraries are in some subdirectory of the directory the application is in.

DEVPATH works even if the application is in some other directory, but requires developmentMode to be set. When developmentMode is set but DEVPATH is not set, the application does not seem to start at all (terminates without any error message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant