var resolver = DefaultAssemblyResolver ?? new XamlCAssemblyResolver();
if (resolver is XamlCAssemblyResolver xamlCResolver) {
if (!string.IsNullOrEmpty(DependencyPaths)) {
- foreach (var dep in DependencyPaths.Split(';')) {
+ foreach (var dep in DependencyPaths.Split(';').Distinct()) {
LoggingHelper.LogMessage(Low, $"{new string(' ', 2)}Adding searchpath {dep}");
xamlCResolver.AddSearchDirectory(dep);
}
}
if (!string.IsNullOrEmpty(ReferencePath)) {
- var paths = ReferencePath.Replace("//", "/").Split(';');
+ var paths = ReferencePath.Replace("//", "/").Split(';').Distinct();
foreach (var p in paths) {
var searchpath = Path.GetDirectoryName(p);
LoggingHelper.LogMessage(Low, $"{new string(' ', 2)}Adding searchpath {searchpath}");
_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();
_xmlnsModules = new Dictionary<string, ModuleDefinition>();
- if (string.IsNullOrEmpty(this.References))
+ if (string.IsNullOrEmpty(References))
return;
- string[] paths = this.References.Split(';');
+ string[] paths = References.Split(';').Distinct().ToArray();
- foreach ( var path in paths ) {
+ foreach (var path in paths) {
string asmName = Path.GetFileName(path);
- if ( AssemblyIsSystem(asmName) )
+ if (AssemblyIsSystem(asmName))
// Skip the myriad "System." assemblies and others
continue;
using (var asmDef = AssemblyDefinition.ReadAssembly(path)) {
- foreach ( var ca in asmDef.CustomAttributes ) {
- if ( ca.AttributeType.FullName == typeof(XmlnsDefinitionAttribute).FullName) {
+ foreach (var ca in asmDef.CustomAttributes) {
+ if (ca.AttributeType.FullName == typeof(XmlnsDefinitionAttribute).FullName) {
_xmlnsDefinitions.Add(ca.GetXmlnsDefinition(asmDef));
_xmlnsModules[asmDef.FullName] = asmDef.MainModule;
}