Skip to content

refactor Visual Studio file importing - #8803

Open
IOBYTE wants to merge 2 commits into
cppcheck-opensource:mainfrom
IOBYTE:main
Open

refactor Visual Studio file importing#8803
IOBYTE wants to merge 2 commits into
cppcheck-opensource:mainfrom
IOBYTE:main

Conversation

@IOBYTE

@IOBYTE IOBYTE commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

After many aborted attempts to add new features to the Visual Studio importers I came to the realization that the existing code was fundamentally flawed in 4 ways.

  1. We didn't collect all properties and metadata in the variables map.
  2. We didn't evaluate all conditions as we encountered them.
  3. We didn't handle paths properly.
  4. We didn't support self-referencing properties.

This PR collects all properties and metadata and simplifies them.
It simplifies and evaluates conditions when encountered.
It handles file paths properly by making them all absolute internally.
It handles self-referencing properties.

This is all done just like Visual studio and verified using MSBuild log files.

importVcxproj now only supports reading real files. The testVcxprojUnicode test in testimportproject.cpp passed a tinyxml2::XMLDocument to importVcxproj and
that required many hacks to make work. That test was moved to a real file in test/cli.
New tests were added for props files and for ForcedIncludeFiles. Support for many missing XML elements were added. The code is now simpler and just works with a lot more properties.

This refactor is about a 75% solution. Support for more uncommon Visual Studio stuff can be added later. Some things can never be implemented and some things can only be supported with a Visual Studio compiler installed on the machine and adding some way to tell cppcheck where it's installed. That's probably not worth the effort.

We still just ignore stuff that we can't handle. I would like to add support for generating debug message when we ignore things we don't understand so they can be fixed but that can be implemented later.

@IOBYTE
IOBYTE requested a review from danmar August 20, 2026 00:30
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

Successfully merging this pull request may close these issues.

1 participant