private void AddReferencedAssembly(string referenceName, AssemblyName assemblyName) { var uniqueName = assemblyName.ToString(); if (_assemblyRefHandles.ContainsKey(uniqueName)) { return; } var token = assemblyName.GetPublicKeyToken(); if (token != null && _coreLibToken != null && token.SequenceEqual(_coreLibToken)) { return; } var key = assemblyName.GetPublicKey(); var hashOrToken = token ?? key; var handle = Builder.AddAssemblyReference( GetOrAddString(referenceName), assemblyName.Version, GetOrAddString(assemblyName.CultureName), Builder.GetOrAddBlob(hashOrToken), MetadataHelper.ConvertReferencedAssemblyNameFlags(assemblyName.Flags), default); // Null is allowed _assemblyRefHandles.Add(uniqueName, handle); }