diff --git a/ATxCommon/Serializables/ServiceConfig.cs b/ATxCommon/Serializables/ServiceConfig.cs index 0963d7328f11f579ecc5b255435b284248a746b8..a811ec8703b3665a1da72a8e4137cbe48ec69d69 100644 --- a/ATxCommon/Serializables/ServiceConfig.cs +++ b/ATxCommon/Serializables/ServiceConfig.cs @@ -281,12 +281,15 @@ namespace ATxCommon.Serializables // behaviour of the .NET XmlSerializer on duplicates: only the first occurrence is // used, all other ones are silentley being discarded - this way we simply append the // contents of the common config file to the host-specific and deserialize then: - var common = XElement.Load(commonFile); - Log.Debug("Loaded common configuration XML file: [{0}]", commonFile); var combined = XElement.Load(specificFile); Log.Debug("Loaded host specific configuration XML file: [{0}]", specificFile); - combined.Add(common.Nodes()); - Log.Trace("Combined XML structure:\n\n{0}\n\n", combined); + // the common configuration file is optional, so check if it exists at all: + if (File.Exists(commonFile)) { + var common = XElement.Load(commonFile); + Log.Debug("Loaded common configuration XML file: [{0}]", commonFile); + combined.Add(common.Nodes()); + Log.Trace("Combined XML structure:\n\n{0}\n\n", combined); + } using (var reader = XmlReader.Create(new StringReader(combined.ToString()))) { Log.Debug("Trying to parse combined XML.");