diff --git a/src/NServiceBus.FileBasedRouting.Tests/XmlRoutingFileTests.cs b/src/NServiceBus.FileBasedRouting.Tests/XmlRoutingFileTests.cs
index ae36c60..04d239d 100644
--- a/src/NServiceBus.FileBasedRouting.Tests/XmlRoutingFileTests.cs
+++ b/src/NServiceBus.FileBasedRouting.Tests/XmlRoutingFileTests.cs
@@ -120,6 +120,25 @@ public void It_provides_distinct_result_even_when_types_are_registered_multiple_
CollectionAssert.AreEquivalent(new[] { typeof(A), typeof(B) }, configuration.Commands);
}
+ [Test]
+ public void It_does_not_throw_if_assembly_cannot_be_found()
+ {
+ const string xml = @"
+
+
+
+
+
+
+
+ ";
+ var configurations = GetConfigurations(xml);
+
+ Assert.AreEqual(1, configurations.Length);
+ var configuration = configurations[0];
+ Assert.AreEqual("EndpointName", configuration.LogicalEndpointName);
+ }
+
static EndpointRoutingConfiguration[] GetConfigurations(string xml)
{
diff --git a/src/NServiceBus.FileBasedRouting/XmlRoutingFileParser.cs b/src/NServiceBus.FileBasedRouting/XmlRoutingFileParser.cs
index 3b0d895..1bde7d3 100644
--- a/src/NServiceBus.FileBasedRouting/XmlRoutingFileParser.cs
+++ b/src/NServiceBus.FileBasedRouting/XmlRoutingFileParser.cs
@@ -82,7 +82,17 @@ static Type FindMessageType(string typeName)
static IEnumerable SelectMessages(XElement commandsElement)
{
var assemblyName = commandsElement.Attribute("assembly").Value;
- var assembly = Assembly.Load(assemblyName);
+ Assembly assembly;
+ try
+ {
+ assembly = Assembly.Load(assemblyName);
+ }
+ catch
+ {
+ logger.Warn($"Cannot add route for unknown assembly {assemblyName}.");
+ return Enumerable.Empty();
+ }
+
var exportedTypes = assembly.ExportedTypes;
var @namespace = commandsElement.Attribute("namespace");
if (@namespace == null)