diff --git a/Solutionizer.sln.DotSettings b/Solutionizer.sln.DotSettings index 976e42e..b125556 100644 --- a/Solutionizer.sln.DotSettings +++ b/Solutionizer.sln.DotSettings @@ -98,6 +98,7 @@ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> No True + True True diff --git a/Solutionizer/Models/Project.cs b/Solutionizer/Models/Project.cs index 470a523..6e032e8 100644 --- a/Solutionizer/Models/Project.cs +++ b/Solutionizer/Models/Project.cs @@ -13,7 +13,7 @@ public class Project { private string _assemblyName; private Guid _guid; private bool _isSccBound; - private List _projectReferences; + private List _projectReferences = new List(); private readonly List _brokenProjectReferences = new List(); private readonly List _errors = new List(); private Task> _taskLoadConfigurations; @@ -47,7 +47,13 @@ public class Project { throw new ArgumentException("Not a valid VS2005 C# project file: \"" + _filepath + "\""); } - var assemblyName = xmlDocument.GetElementsByTagName("AssemblyName")[0].FirstChild.Value; + var assemblyNameElements = xmlDocument.GetElementsByTagName("AssemblyName"); + if (assemblyNameElements.Count == 0) { + _errors.Add("Not a valid project file."); + return; + } + + var assemblyName = assemblyNameElements[0].FirstChild.Value; var guid = Guid.Parse(xmlDocument.GetElementsByTagName("ProjectGuid")[0].FirstChild.Value); var directoryName = Path.GetDirectoryName(_filepath);