From 83e25767f32db3926f76470ec06046afe1309e35 Mon Sep 17 00:00:00 2001 From: latkin Date: Thu, 12 Mar 2015 17:44:20 -0700 Subject: [PATCH] Make sure assembly search paths for #r directives include directory of declaring source file fixes #273 fixes #293 --- src/fsharp/build.fs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/fsharp/build.fs b/src/fsharp/build.fs index 6109974452f..99c1b15964b 100644 --- a/src/fsharp/build.fs +++ b/src/fsharp/build.fs @@ -2705,9 +2705,15 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = let isNetModule = String.Compare(ext,".netmodule",StringComparison.OrdinalIgnoreCase)=0 if String.Compare(ext,".dll",StringComparison.OrdinalIgnoreCase)=0 || String.Compare(ext,".exe",StringComparison.OrdinalIgnoreCase)=0 - || isNetModule then + || isNetModule then - let resolved = TryResolveFileUsingPaths(tcConfig.SearchPathsForLibraryFiles,m,nm) + let searchPaths = + if m <> range0 && m <> rangeStartup && m <> rangeCmdArgs && FileSystem.IsPathRootedShim m.FileName then + tcConfig.SearchPathsForLibraryFiles @ [Path.GetDirectoryName(m.FileName)] + else + tcConfig.SearchPathsForLibraryFiles + + let resolved = TryResolveFileUsingPaths(searchPaths,m,nm) match resolved with | Some(resolved) -> let sysdir = tcConfig.IsSystemAssembly resolved