public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string?baseFilePath, MetadataReferenceProperties properties) { // nuget references will be resolved externally if (reference.StartsWith("nuget:", StringComparison.InvariantCultureIgnoreCase) || reference.StartsWith("framework:", StringComparison.InvariantCultureIgnoreCase) || reference.StartsWith("$NuGet", StringComparison.InvariantCultureIgnoreCase)) { return(_unresolved); } if (_cache == null) { return(_inner.ResolveReference(reference, baseFilePath, properties)); } if (!_cache.TryGetValue(reference, out var result)) { result = _inner.ResolveReference(reference, baseFilePath, properties); if (!result.IsDefaultOrEmpty) { _cache.TryAdd(reference, result); } } return(result); }
public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { if (reference == null) { return(ImmutableArray <PortableExecutableReference> .Empty); } if (!HasValidAssemblyFileExtension(reference)) { // Try to resolve using the default resolver (framework assemblies, e.g. System.Core, System.Xml, etc.) ImmutableArray <PortableExecutableReference> result = _scriptResolver.ResolveReference(reference, baseFilePath, properties); // If the default script resolver can't resolve the assembly // check if this is one of host's shared assemblies if (result.IsEmpty) { Assembly assembly = null; if (SharedAssemblyProviders.Any(p => p.TryResolveAssembly(reference, out assembly)) || _extensionSharedAssemblyProvider.TryResolveAssembly(reference, out assembly)) { result = ImmutableArray.Create(MetadataReference.CreateFromFile(assembly.Location)); } } return(result); } return(GetMetadataFromReferencePath(reference)); }
public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { if (reference == null) { return(ImmutableArray <PortableExecutableReference> .Empty); } if (!HasValidAssemblyFileExtension(reference)) { // Try to resolve using the default resolver (framework assemblies, e.g. System.Core, System.Xml, etc.) ImmutableArray <PortableExecutableReference> result = _scriptResolver.ResolveReference(reference, baseFilePath, properties); // If the default script resolver can't resolve the assembly // check if this is one of host's shared assemblies if (result.IsEmpty) { Assembly assembly = SharedAssemblies .FirstOrDefault(m => string.Compare(m.GetName().Name, reference, StringComparison.OrdinalIgnoreCase) == 0); if (assembly != null) { result = ImmutableArray.Create(MetadataReference.CreateFromFile(assembly.Location)); } } return(result); } return(GetMetadataFromReferencePath(reference)); }
public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { reference = NuGetConfigurationExtensions.ResolveReference(_nuGetConfiguration, reference); if (_cache == null) { return(_inner.ResolveReference(reference, baseFilePath, properties)); } if (!_cache.TryGetValue(reference, out var result)) { result = _inner.ResolveReference(reference, baseFilePath, properties); if (!result.IsDefaultOrEmpty) { _cache.TryAdd(reference, result); } } return(result); }
public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { if (reference.StartsWith(PaketPrefix)) { // dummy reference return(ImmutableArray.Create(PortableExecutableReference.CreateFromFile(typeof(PaketScriptMetadataResolver).GetTypeInfo().Assembly.Location))); } else { return(_inner.ResolveReference(reference, baseFilePath, properties)); } }
public override ImmutableArray <PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { reference = _nuGetConfiguration.ResolveReference(reference); return(_inner.ResolveReference(reference, baseFilePath, properties)); }