Exemplo n.º 1
0
        public LibraryDescription GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
        {
            if (!libraryRange.IsGacOrFrameworkReference)
            {
                return(null);
            }

            if (!RuntimeEnvironmentHelper.IsWindows)
            {
                return(null);
            }

            if (!VersionUtility.IsDesktop(targetFramework))
            {
                return(null);
            }

            var name    = libraryRange.Name;
            var version = libraryRange.VersionRange?.MinVersion;

            string path;

            if (!TryResolvePartialName(libraryRange.GetReferenceAssemblyName(), version, out path))
            {
                return(null);
            }

            _resolvedPaths[name] = path;

            return(new LibraryDescription
            {
                LibraryRange = libraryRange,
                Identity = new Library
                {
                    Name = name,
                    Version = version,
                    IsGacOrFrameworkReference = true
                },
                LoadableAssemblies = new[] { libraryRange.GetReferenceAssemblyName() },
                Dependencies = Enumerable.Empty <LibraryDependency>()
            });
        }
Exemplo n.º 2
0
        public LibraryDescription GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
        {
            if (!libraryRange.IsGacOrFrameworkReference)
            {
                return(null);
            }

            var name    = libraryRange.GetReferenceAssemblyName();
            var version = libraryRange.VersionRange?.MinVersion;

            string  path;
            Version assemblyVersion;

            if (!FrameworkResolver.TryGetAssembly(name, targetFramework, out path, out assemblyVersion))
            {
                return(null);
            }

            if (version == null || version.Version == assemblyVersion)
            {
                _resolvedPaths[libraryRange.Name] = path;

                return(new LibraryDescription
                {
                    LibraryRange = libraryRange,
                    Identity = new Library
                    {
                        Name = libraryRange.Name,
                        Version = new SemanticVersion(assemblyVersion),
                        IsGacOrFrameworkReference = true
                    },
                    LoadableAssemblies = new[] { name },
                    Dependencies = Enumerable.Empty <LibraryDependency>()
                });
            }

            return(null);
        }