diff --git a/LibGit2Sharp.sln b/LibGit2Sharp.sln
index 64945776b..aaba7526e 100644
--- a/LibGit2Sharp.sln
+++ b/LibGit2Sharp.sln
@@ -1,13 +1,12 @@
-
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26407.1
+VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp.Tests", "LibGit2Sharp.Tests\LibGit2Sharp.Tests.csproj", "{286E63EB-04DD-4ADE-88D6-041B57800761}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp.Tests", "LibGit2Sharp.Tests\LibGit2Sharp.Tests.csproj", "{286E63EB-04DD-4ADE-88D6-041B57800761}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerationAttributes", "CodeGenerationAttributes\CodeGenerationAttributes.csproj", "{E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeGenerationAttributes", "CodeGenerationAttributes\CodeGenerationAttributes.csproj", "{E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0CA739FD-DA4D-4F64-9834-DA14A3ECD04B}"
ProjectSection(SolutionItems) = preProject
@@ -17,8 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProjectSection
EndProject
Global
- GlobalSection(SharedMSBuildProjectFiles) = preSolution
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@@ -40,4 +37,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1F70B2E1-2633-4E6A-A6EE-EE0ED0288886}
+ EndGlobalSection
EndGlobal
diff --git a/LibGit2Sharp/GlobalSettings.cs b/LibGit2Sharp/GlobalSettings.cs
index eef92c07c..1bd84cc29 100644
--- a/LibGit2Sharp/GlobalSettings.cs
+++ b/LibGit2Sharp/GlobalSettings.cs
@@ -23,19 +23,42 @@ static GlobalSettings()
{
if (Platform.OperatingSystem == OperatingSystemType.Windows)
{
+
+ string managedPath = string.Empty;
+
#if DESKTOP
+ var assembly = Assembly.GetExecutingAssembly();
+ managedPath = assembly.CodeBase;
+ if (managedPath == null)
+ {
+ managedPath = assembly.Location;
+ }
+#else
+ var assembly = typeof(GlobalSettings).GetTypeInfo().Assembly;
+ var codeBaseProp = assembly.GetType().GetProperty("CodeBase");
+ if(codeBaseProp != null)
+ {
+ managedPath = (string)codeBaseProp.GetValue(assembly);
+ }
+ if (managedPath == null)
+ {
+ var locationProp = assembly.GetType().GetProperty("Location");
+ if(locationProp != null)
+ {
+ managedPath = (string)locationProp.GetValue(assembly);
+ }
+ }
+#endif
+
+
/* Assembly.CodeBase is not actually a correctly formatted
* URI. It's merely prefixed with `file:///` and has its
* backslashes flipped. This is superior to EscapedCodeBase,
* which does not correctly escape things, and ambiguates a
* space (%20) with a literal `%20` in the path. Sigh.
*/
- var managedPath = Assembly.GetExecutingAssembly().CodeBase;
- if (managedPath == null)
- {
- managedPath = Assembly.GetExecutingAssembly().Location;
- }
- else if (managedPath.StartsWith("file:///"))
+
+ if (managedPath.StartsWith("file:///"))
{
managedPath = managedPath.Substring(8).Replace('/', '\\');
}
@@ -45,10 +68,6 @@ static GlobalSettings()
}
managedPath = Path.GetDirectoryName(managedPath);
-#else
- string managedPath = AppContext.BaseDirectory;
-#endif
-
nativeLibraryPath = Path.Combine(managedPath, "lib", "win32");
}
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index cf3d667c6..d77a8c77c 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -41,7 +41,8 @@
-
+
+