aboutcode-org / nuget-inspector

Inspect and resolve .NET and NuGet package dependencies like dotnet and nuget do. Fetch manifests data. Runs on Linux, Windows and macOS as a standalone application.
https://github.com/nexB/nuget-inspector
4 stars 4 forks source link

zlib.csproj shows an error when working with nuget-inspector #44

Open sankalpa-menon opened 1 year ago

sankalpa-menon commented 1 year ago

Hi, I am getting the following error when trying to use zlib.csproj with nuget inspector.

nuget-inspector --project-file zlib.csproj --json out.json

Scan completed with Errors or Warnings: JSON file created at: out.json

ERROR: Failed to process project file: zlib.csproj with: Microsoft.Build.Exceptions.InvalidProjectFileException: The project file "/home/zlib.csproj" must be opened in the Visual Studio IDE and converted to the latest version before it can be built by MSBuild. /home/zlib.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1](Boolean condition, String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, T1 arg0) at Microsoft.Build.Construction.ProjectParser.Parse() at Microsoft.Build.Construction.ProjectParser.Parse(XmlDocumentWithLocation document, ProjectRootElement projectRootElement) at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.<>c.b__208_0(String path, ProjectRootElementCacheBase cache) at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement loadProjectRootElement, Boolean isExplicitlyLoaded, Nullable1 preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary2 globalProperties, String toolsVersion, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded) at Microsoft.Build.Evaluation.Project.ProjectImpl..ctor(Project owner, String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion) at NugetInspector.ProjectFileProcessor.GetPackageReferences() in ./nuget-inspector/ProjectFileProcessor.cs:line 134 at NugetInspector.ProjectFileProcessor.ResolveUsingLib() in ./nuget-inspector/ProjectFileProcessor.cs:line 427 at NugetInspector.ProjectScanner.RunScan() in ./nuget-inspector/ProjectScanner.cs:line 293

ERRORS at the dependencies level:

pombredanne commented 1 year ago

@sankalpa-menon Thank you for the report? Can you share this zlib.csproj file?

sankalpa-menon commented 1 year ago

@pombredanne Thank you for your response. Please find the below zlib.csproj file. https://github.com/madler/zlib/blob/v1.2.11/contrib/dotzlib/DotZLib/DotZLib.csproj

pombredanne commented 1 year ago

@sankalpa-menon this file https://github.com/madler/zlib/blob/v1.2.11/contrib/dotzlib/DotZLib/DotZLib.csproj is 12 years old! And based on https://github.com/madler/zlib/blob/master/contrib/dotzlib/readme.txt this is a Visual Studio 2003 format which is 20 years old. NuGet started only around late 2010: https://web.archive.org/web/20101107185811/http://nuget.codeplex.com/

We will not support this 2003 format :)

There is nothing we can do with this short of this being updated. Note that there are no external NuGet package references anyway as nuget did not even exist back then so there would not be much for nuget-inspector to do here even on an updated file.

If you are a good soul, I suggest you consider contributing an updated csproj file upstream to zlib.

sankalpa-menon commented 1 year ago

@pombredanne : Thanks for your response!