Added missing guard clauses

Also updated to NuGet 2.7 to take advantage of the new developmentDependency feature