The exact name (e.g. version) might differ between the original
AssemblyNameReference and the one being used (e.g. PCL).
To make sure we remove unused references we need to resolve
the AssemblyNameReference into AssemblyDefinition and then
continue the sweep based on the _new_ AssemblyNameReference.
var references = assembly.MainModule.AssemblyReferences;
for (int i = 0; i < references.Count; i++) {
var reference = references [i];
- if (!AreSameReference (reference, target.Name))
+ var r = Context.Resolver.Resolve (reference);
+ if (!AreSameReference (r.Name, target.Name))
continue;
references.RemoveAt (i);