Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2790,22 +2790,26 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
error(Error(FSComp.SR.buildExplicitCoreLibRequiresNoFramework("--noframework"), rangeStartup))

let ilGlobals = mkILGlobals ILScopeRef.Local

// clrRoot: the location of the primary assembly (mscorlib.dll or netstandard.dll or System.Runtime.dll)
//
// targetFrameworkVersionValue: Normally just HighestInstalledNetFrameworkVersion()
//
// Note, when mscorlib.dll has been given explicitly the actual value of
// targetFrameworkVersion shouldn't matter since resolution has already happened.
// In those cases where it does matter (e.g. --noframework is not being used or we are processing further
// resolutions for a script) then it is correct to just use HighestInstalledNetFrameworkVersion().
let clrRootValue, targetFrameworkVersionValue =
match primaryAssemblyExplicitFilenameOpt with
| Some(primaryAssemblyFilename) ->
| Some primaryAssemblyFilename ->
let filename = ComputeMakePathAbsolute data.implicitIncludeDir primaryAssemblyFilename
try
use ilReader = OpenILBinary(filename, data.reduceMemoryUsage, ilGlobals, None, data.shadowCopyReferences, data.tryGetMetadataSnapshot)
let ilModule = ilReader.ILModuleDef
match ilModule.ManifestOfAssembly.Version with
| Some(v1, v2, _, _) ->
let clrRoot = Some(Path.GetDirectoryName(FileSystem.GetFullPathShim(filename)))
clrRoot, (sprintf "v%d.%d" v1 v2)
| _ ->
failwith (FSComp.SR.buildCouldNotReadVersionInfoFromMscorlib())
let clrRoot = Some(Path.GetDirectoryName(FileSystem.GetFullPathShim(filename)))
clrRoot, data.legacyReferenceResolver.HighestInstalledNetFrameworkVersion()
with e ->
// We no longer expect the above to fail but leaving this just in case
error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message), rangeStartup))
| _ ->
| None ->
#if !ENABLE_MONO_SUPPORT
// TODO: we have to get msbuild out of this
if data.useSimpleResolution then
Expand All @@ -2821,6 +2825,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
let fsharpBinariesDirValue =
// NOTE: It's not clear why this behaviour has been changed for the NETSTANDARD compilations of the F# compiler
#if NETSTANDARD1_6 || NETSTANDARD2_0
ignore ilGlobals
data.defaultFSharpBinariesDir
#else
match fslibExplicitFilenameOpt with
Expand Down
1 change: 0 additions & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ buildProductNameCommunity,"F# Compiler for F# %s"
213,buildInvalidAssemblyName,"'%s' is not a valid assembly name"
214,buildInvalidPrivacy,"Unrecognized privacy setting '%s' for managed resource, valid options are 'public' and 'private'"
215,buildMultipleReferencesNotAllowed,"Multiple references to '%s.dll' are not permitted"
buildCouldNotReadVersionInfoFromMscorlib,"Could not read version from mscorlib.dll"
218,buildCannotReadAssembly,"Unable to read assembly '%s'"
220,buildAssemblyResolutionFailed,"Assembly resolution failure at or near this location"
221,buildImplicitModuleIsNotLegalIdentifier,"The declarations in this file will be placed in an implicit module '%s' based on the file name '%s'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file."
Expand Down
46 changes: 24 additions & 22 deletions src/fsharp/SimulatedMSBuildReferenceResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -147,35 +147,37 @@ let internal SimulatedMSBuildResolver =
match n.Version, n.GetPublicKeyToken() with
| null, _ | _,null ->
let options =
[ for gacdir in Directory.EnumerateDirectories(gac) do
let assdir = Path.Combine(gacdir,n.Name)
if Directory.Exists(assdir) then
for tdir in Directory.EnumerateDirectories(assdir) do
let trialPath = Path.Combine(tdir,qual)
if FileSystem.SafeExists(trialPath) then
yield trialPath ]
[ if Directory.Exists(gac) then
for gacdir in Directory.EnumerateDirectories(gac) do
let assemblyDir = Path.Combine(gacdir,n.Name)
if Directory.Exists(assemblyDir) then
for tdir in Directory.EnumerateDirectories(assemblyDir) do
let trialPath = Path.Combine(tdir,qual)
if FileSystem.SafeExists(trialPath) then
yield trialPath ]
//printfn "sorting GAC paths: %A" options
options
|> List.sort // puts latest version last
|> List.tryLast
|> function None -> () | Some p -> success p

| v,tok ->
for gacdir in Directory.EnumerateDirectories(gac) do
//printfn "searching GAC directory: %s" gacdir
let assdir = Path.Combine(gacdir,n.Name)
if Directory.Exists(assdir) then
//printfn "searching GAC directory: %s" assdir

let tokText = String.concat "" [| for b in tok -> sprintf "%02x" b |]
let verdir = Path.Combine(assdir,"v4.0_"+v.ToString()+"__"+tokText)
//printfn "searching GAC directory: %s" verdir

if Directory.Exists(verdir) then
let trialPath = Path.Combine(verdir,qual)
//printfn "searching GAC: %s" trialPath
if FileSystem.SafeExists(trialPath) then
success trialPath
if Directory.Exists(gac) then
for gacdir in Directory.EnumerateDirectories(gac) do
//printfn "searching GAC directory: %s" gacdir
let assemblyDir = Path.Combine(gacdir,n.Name)
if Directory.Exists(assemblyDir) then
//printfn "searching GAC directory: %s" assemblyDir

let tokText = String.concat "" [| for b in tok -> sprintf "%02x" b |]
let verdir = Path.Combine(assemblyDir,"v4.0_"+v.ToString()+"__"+tokText)
//printfn "searching GAC directory: %s" verdir

if Directory.Exists(verdir) then
let trialPath = Path.Combine(verdir,qual)
//printfn "searching GAC: %s" trialPath
if FileSystem.SafeExists(trialPath) then
success trialPath
with e -> logWarningOrError false "SR001" (e.ToString())
#endif

Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Víc odkazů na knihovnu {0}.dll se nepovoluje.</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Nedala se přečíst verze souboru mscorlib.dll.</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Sestavení {0} se nedá přečíst.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Mehrere Verweise auf "{0}.dll" sind nicht zulässig</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Version konnte nicht aus "mscorlib.dll" gelesen werden.</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Assembly "{0}" kann nicht gelesen werden.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="new">Multiple references to '{0}.dll' are not permitted</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="new">Could not read version from mscorlib.dll</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="new">Unable to read assembly '{0}'</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">No se permiten varias referencias a '{0}.dll'.</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">No se pudo leer la versión de mscorlib.dll.</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">No se puede leer el ensamblado '{0}'.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Les références multiples à '{0}.dll' ne sont pas autorisées</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Impossible de lire la version à partir de mscorlib.dll</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Impossible de lire l'assembly '{0}'</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Non sono consentiti più riferimenti a '{0}.dll'</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Non è stato possibile leggere la versione da mscorlib.dll</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Non è possibile leggere l'assembly '{0}'</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">'{0}.dll' に対する複数の参照は許可されていません</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">mscorlib.dll からバージョンを読み取ることができませんでした</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">アセンブリ '{0}' を読み取れません</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">'{0}.dll'에 대한 다중 참조는 허용되지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">mscorlib.dll에서 버전을 읽을 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">'{0}' 어셈블리를 읽을 수 없습니다.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Używanie wielu odwołań do pliku „{0}.dll” jest niedozwolone</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Nie można odczytać wersji z pliku mscorlib.dll</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Nie można odczytać zestawu „{0}”</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">As referências múltiplas '{0}.dll' não são permitidas</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Não foi possível ler a versão em mscorlib.dll</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Não é possível ler o assembly '{0}'</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Множественные ссылки на файлы "{0}.dll" не допускаются</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Не удалось прочитать версию из библиотеки mscorlib.dll</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">Не удается прочитать сборку "{0}"</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">Birden çok '{0}.dll' başvurusuna izin verilmiyor</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">Sürüm, mscorlib.dll'den okunamadı</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">'{0}' bütünleştirilmiş kodu okunamıyor</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">不允许多次引用“{0}.dll”</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">未能从 mscorlib.dll 读取版本</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">无法读取程序集“{0}”</target>
Expand Down
5 changes: 0 additions & 5 deletions src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@
<target state="translated">不允許多次參考 '{0}.dll'</target>
<note />
</trans-unit>
<trans-unit id="buildCouldNotReadVersionInfoFromMscorlib">
<source>Could not read version from mscorlib.dll</source>
<target state="translated">無法從 mscorlib.dll 讀取版本</target>
<note />
</trans-unit>
<trans-unit id="buildCannotReadAssembly">
<source>Unable to read assembly '{0}'</source>
<target state="translated">無法讀取組件 '{0}'</target>
Expand Down