{
foreach (FileInfo fileReference in commandLineOptions.Reference)
{
- if (!File.Exists(fileReference.FullName))
+ try
+ {
+ if (!File.Exists(fileReference.FullName))
+ {
+ PrintError($"Unable to find reference '{fileReference.FullName}'");
+ filePathError = true;
+ }
+ else
+ tsc.GetModuleFromPath(fileReference.FullName);
+ }
+ catch (Internal.TypeSystem.TypeSystemException.BadImageFormatException)
{
- PrintError($"Unable to find reference '{fileReference.FullName}'");
- filePathError = true;
+ // Ignore BadImageFormat in order to allow users to use '-r *.dll'
+ // in a folder with native dynamic libraries (which have the same extension on Windows).
+
+ // We don't need to log a warning here - it's already logged in GetModuleFromPath
}
- else
- tsc.GetModuleFromPath(fileReference.FullName);
}
}