Exemplo n.º 1
0
        internal MetadataReference CreateMetadataReference(string assemblyDisplayNameOrPath, FileResolver fileResolver)
        {
            if (assemblyDisplayNameOrPath == null)
            {
                throw new ArgumentNullException("assemblyDisplayNameOrPath");
            }

            if (assemblyDisplayNameOrPath.Length == 0)
            {
                throw new ArgumentException("Display name or path cannot be empty.".NeedsLocalization(), "assemblyDisplayNameOrPath");
            }

            string fullPath = fileResolver.ResolveMetadataReference(assemblyDisplayNameOrPath);

            if (fullPath == null)
            {
                throw new FileNotFoundException("Assembly not found.".NeedsLocalization(), assemblyDisplayNameOrPath);
            }

            return(metadataFileProvider.GetReference(fullPath));
        }