Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sankalpa-menon opened this issue May 17, 2023 · 4 comments
Open

Comments

@sankalpa-menon
Copy link

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
Copy link
Contributor

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

@sankalpa-menon
Copy link
Author

@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
Copy link
Contributor

@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
Copy link
Author

@pombredanne : Thanks for your response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants