public string FindAssemblyFile(AssemblyNameReference name) { var targetFramework = TargetFramework.Split(new[] { ",Version=v" }, StringSplitOptions.None); string file = null; switch (targetFramework[0]) { case ".NETCoreApp": case ".NETStandard": if (targetFramework.Length != 2) { return(ResolveInternal(name)); } if (dotNetCorePathFinder == null) { var version = targetFramework[1].Length == 3 ? targetFramework[1] + ".0" : targetFramework[1]; dotNetCorePathFinder = new DotNetCorePathFinder(mainAssemblyFileName, TargetFramework, version); } file = dotNetCorePathFinder.TryResolveDotNetCore(name); if (file != null) { return(file); } return(ResolveInternal(name)); default: return(ResolveInternal(name)); } }
public string FindAssemblyFile(AssemblyNameReference name) { if (name.IsWindowsRuntime) { return(FindWindowsMetadataFile(name)); } string file; switch (targetFrameworkIdentifier) { case TargetFrameworkIdentifier.NETCoreApp: case TargetFrameworkIdentifier.NETStandard: if (IsZeroOrAllOnes(targetFrameworkVersion)) { goto default; } if (dotNetCorePathFinder == null) { dotNetCorePathFinder = new DotNetCorePathFinder(mainAssemblyFileName, targetFramework, targetFrameworkIdentifier, targetFrameworkVersion); } file = dotNetCorePathFinder.TryResolveDotNetCore(name); if (file != null) { return(file); } goto default; case TargetFrameworkIdentifier.Silverlight: if (IsZeroOrAllOnes(targetFrameworkVersion)) { goto default; } file = ResolveSilverlight(name, targetFrameworkVersion); if (file != null) { return(file); } goto default; default: return(ResolveInternal(name)); } }
public AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) { var targetFramework = TargetFramework.Split(new[] { ",Version=v" }, StringSplitOptions.None); string file = null; switch (targetFramework[0]) { case ".NETCoreApp": case ".NETStandard": if (targetFramework.Length != 2) { return(ResolveInternal(name, parameters)); } if (dotNetCorePathFinder == null) { var version = targetFramework[1].Length == 3 ? targetFramework[1] + ".0" : targetFramework[1]; dotNetCorePathFinder = new DotNetCorePathFinder(mainAssemblyFileName, TargetFramework, version, this.loadedAssemblyReferences); } file = dotNetCorePathFinder.TryResolveDotNetCore(name); if (file == null) { return(ResolveInternal(name, parameters)); } else { var asm = ModuleDefinition.ReadModule(file, parameters).Assembly; if (throwOnError && asm == null) { throw new AssemblyResolutionException(name); } return(asm); } default: return(ResolveInternal(name, parameters)); } }