Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 91a23b3

Browse files
committed
Update ReferenceAssembyPath detection
Don't throw exception if `v4.0` path available and `v4.5` is not, plus check for `v4.5.1`.
1 parent 3292d92 commit 91a23b3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ServiceStack.Text/Env.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ public static string ReferenceAssembyPath
8080
{
8181
var programFilesPath = PclExport.Instance.GetEnvironmentVariable("ProgramFiles(x86)") ?? @"C:\Program Files (x86)";
8282
var netFxReferenceBasePath = programFilesPath + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\";
83-
if ((netFxReferenceBasePath + @"v4.0\").DirectoryExists())
84-
referenceAssembyPath = netFxReferenceBasePath + @"v4.0\";
85-
if ((netFxReferenceBasePath + @"v4.5\").DirectoryExists())
83+
if ((netFxReferenceBasePath + @"v4.5.1\").DirectoryExists())
84+
referenceAssembyPath = netFxReferenceBasePath + @"v4.5.1\";
85+
else if ((netFxReferenceBasePath + @"v4.5\").DirectoryExists())
8686
referenceAssembyPath = netFxReferenceBasePath + @"v4.5\";
87+
else if ((netFxReferenceBasePath + @"v4.0\").DirectoryExists())
88+
referenceAssembyPath = netFxReferenceBasePath + @"v4.0\";
8789
else
8890
throw new FileNotFoundException(
8991
"Could not infer .NET Reference Assemblies path, e.g '{0}'.\n".Fmt(netFxReferenceBasePath + @"v4.0\") +

0 commit comments

Comments
 (0)