Is this possible to fetch project's standard of C++ language from .vcxproj files without opening Visual Studio and manually checking it?
C++ version in .vcxproj files
690 Views Asked by WelcomeToMyTutorial At
2
There are 2 best solutions below
1
On
Search the Label <LanguageStandard> in .vcxproj.
Simple test in C++:
fstream file;
file.open(path, ios::in );
if (!file.is_open())
{
cout << -1 << endl;
return;
}
string temp;
string result;
while (getline(file, temp))
{
istringstream ss(temp);
while (ss >> result)
{
if(result.find("<LanguageStandard>") != std::string::npos) std::cout<<result<<std::endl;
}
}
Use python for example:
f=open('FilePath')
lines=f.readlines()
for lines in lines:
if "<LanguageStandard>" in lines:
print(lines)
I can not add comment. So I post answer here.
In Visual Studio C++ project, LanguageStandard will not appear if the language standard has not been changed (Default C++14). After specifying the language explicitly and rebuilding the project, You will find LanguageStandard in the .vcxproj file.
There should be similar code samples in C#.Good luck!