Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[LibGit2Sharp] Issue while loading the native dll on Mono/Windows x86
internal class Program
{
private static void Main(string[] args)
{
string originalAssemblypath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
string parentPath = Path.GetDirectoryName(originalAssemblypath);
string currentArchSubPath = "NativeBinaries/" + ProcessorArchitecture;
string path = Path.Combine(parentPath, currentArchSubPath);
Console.WriteLine("{0} = {1}", "originalAssemblypath", originalAssemblypath);
Console.WriteLine("{0} = {1}", "parentPath", parentPath);
Console.WriteLine("{0} = {1}", "currentArchSubPath", currentArchSubPath);
Console.WriteLine("{0} = {1}", "path", path);
Console.WriteLine();
Console.WriteLine("{0} = {1}", "PATH.Machine", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine));
Console.WriteLine("{0} = {1}", "PATH.User", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User));
Console.WriteLine("{0} = {1}", "PATH.Process", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process));
try
{
Console.WriteLine(Repository.Version);
}
catch (Exception e)
{
Console.WriteLine();
Console.WriteLine("{0} = {1}", "PATH.Machine", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine));
Console.WriteLine("{0} = {1}", "PATH.User", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User));
Console.WriteLine("{0} = {1}", "PATH.Process", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process));
throw;
}
Console.ReadLine();
}
public static string ProcessorArchitecture
{
get
{
if (IntPtr.Size == 8)
{
return "amd64";
}
return "x86";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment