From 35d2964872180cbd0d72315ee2de24083fc7e6ce Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Fri, 10 Jan 2020 05:36:08 +0000 Subject: [PATCH] Better error handling for unsupported project types This will address a common crash for full framework projects --- src/DotNetDelice/App.fs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/DotNetDelice/App.fs b/src/DotNetDelice/App.fs index ffdc048..828a3ed 100644 --- a/src/DotNetDelice/App.fs +++ b/src/DotNetDelice/App.fs @@ -94,15 +94,29 @@ type Cli() = | None -> printfn "Failed to generate the dependency graph for '%s'." path printfn "Ensure that the project has been restored and compiled before running delice." - printfn "delice only supports SDK project files (.NET Core, NETStandard, etc.), not legacy MSBuild ones (common for .NET Framework)." + printfn + "delice only supports SDK project files (.NET Core, NETStandard, etc.), not legacy MSBuild ones (common for .NET Framework)." | Some dependencyGraph -> let getLicenses' = getLicenses this.CheckGitHub this.GitHubToken this.CheckLicenseContent if this.Json then dependencyGraph.Projects + |> Seq.filter (fun projectSpec -> projectSpec.RestoreMetadata.ProjectStyle <> ProjectStyle.Unknown) |> Seq.map (fun projectSpec -> getLicenses' projectSpec |> jsonBuilder projectSpec.Name) |> jsonPrinter this.JsonOutput else dependencyGraph.Projects + |> Seq.filter (fun projectSpec -> projectSpec.RestoreMetadata.ProjectStyle <> ProjectStyle.Unknown) |> Seq.iter (fun projectSpec -> getLicenses' projectSpec |> prettyPrint projectSpec.Name printfn "") + + let unknownProjectStyles = + dependencyGraph.Projects + |> Seq.filter (fun projectSpec -> projectSpec.RestoreMetadata.ProjectStyle = ProjectStyle.Unknown) + if Seq.length unknownProjectStyles > 1 then + printfn "The following projects were skipped as they are of an unsupported project style:" + unknownProjectStyles + |> Seq.iteri (fun i projectSpec -> + let prefix = + if i = Seq.length unknownProjectStyles - 1 then "ā””" else "ā”œ" + printfn "%sā”€ā”€ %s" prefix projectSpec.Name)