Exemple #1
0
        private static string GetReferenceInclude(LibraryRef reference)
        {
            if (reference.Kind == LibraryRef.RefKind.Reference &&
                IsGacReference(reference.Value) &&
                _netFrameworkAssemblies.Value.TryGetValue(reference.Value, out var referenceAssembly))
            {
                return(referenceAssembly);
            }

            return(reference.Value);
Exemple #2
0
        public static Library ResolveLibrary(LibraryRef libraryRef, VerificationContext context)
        {
            Library library;

            if (!_libraries.TryGetValue(libraryRef.Name, out library))
            {
                if (context == null)
                {
                    throw new InvalidOperationException("Cannot perform type verification on a library without a verification context.");
                }

                if (resolvingLibraries.Contains(libraryRef.Name))
                {
                    throw new InvalidOperationException(String.Format("Circular library reference to library {0}.", libraryRef.Name));
                }

                resolvingLibraries.Push(libraryRef.Name);
                try
                {
                    library = LibraryReaderFactory.GetHandler(libraryRef.MediaType).Read(libraryRef);
                    var verifier = new LibraryVerifier();
                    IEnumerable <VerificationException> results = verifier.Verify(library);
                    context.Messages.AddRange(results);
                    _libraries.Add(libraryRef.Name, library);

                    if (results.Any(r => !r.IsWarning))
                    {
                        throw new InvalidOperationException(String.Format("Errors encountered while verifying library {0}.", libraryRef.Name));
                    }
                }
                finally
                {
                    resolvingLibraries.Pop();
                }
            }

            return(library);
        }
Exemple #3
0
        private static void AddPackageToFramework(TargetFrameworkInformation targetFramework, LibraryRef library)
        {
            if (library.Path != null)
            {
                return;
            }

            targetFramework.Dependencies.Add(new LibraryDependency
            {
                LibraryRange = new LibraryRange(library.Id, library.VersionRange, LibraryDependencyTarget.Package)
            });
        }