IDsDocument ResolveNormal(IAssembly assembly, ModuleDef sourceModule) { var existingDocument = documentService.FindAssembly(assembly); if (existingDocument != null) { return(existingDocument); } var dotNetCoreAppVersion = dotNetCorePathProvider.TryGetDotNetCoreVersion(sourceModule); var document = LookupFromSearchPaths(assembly, sourceModule, dotNetCoreAppVersion); if (document != null) { return(documentService.GetOrAddCanDispose(document, assembly)); } var gacFile = GacInfo.FindInGac(assembly); if (gacFile != null) { return(documentService.TryGetOrCreateInternal(DsDocumentInfo.CreateDocument(gacFile), true, true)); } foreach (var path in GacInfo.OtherGacPaths) { document = TryLoadFromDir(assembly, true, path); if (document != null) { return(documentService.GetOrAddCanDispose(document, assembly)); } } return(null); }
FrameworkKind GetRuntimeFrameworkKind(string filename, out Version netCoreVersion) { foreach (var gacPath in GacInfo.GacPaths) { if (FileUtils.IsFileInDir(gacPath.Path, filename)) { netCoreVersion = null; Debug.Assert(gacPath.Version == GacVersion.V2 || gacPath.Version == GacVersion.V4); return gacPath.Version == GacVersion.V2 ? FrameworkKind.DotNetFramework2 : FrameworkKind.DotNetFramework4; } } netCoreVersion = dotNetCorePathProvider.TryGetDotNetCoreVersion(filename); if (netCoreVersion != null) return FrameworkKind.DotNetCore; netCoreVersion = null; return FrameworkKind.Unknown; }