Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if a Visual Studio project file represents application, DLL or static library project?

I am writing a tool which inspects my source tree looking for .vcproj and .csproj projects (VS2005). I want it to know if each project is an application, DLL or static lib project.

For C#, I think this question has an answer ( How do you tell the Visual Studio project type from an existing Visual Studio project ) but I can't find an obvious parallel in C++ projects. I prefer something I can use as a simple search term in the text if possible.

like image 898
Mr. Boy Avatar asked Jan 16 '13 12:01

Mr. Boy


People also ask

How do I know the project type in Visual Studio?

If you are working in Visual Studio, you can quickly check the project format using one of the following methods: Right-click the project in Solution Explorer and select Edit myprojectname. csproj. This option is only available starting in Visual Studio 2017 for projects that use the SDK-style attribute.

How will you know the type of project in Visual Studio 2022?

Right Click on Project of a solution. Open Properties -> Application Tab. On the right you can see 'Output Type' which defines your project type of an existing solution.

Can a static library use a DLL?

All you need to do in order to use such library (either in .exe or . dll ) is to include proper headers and link them - with Visual Studio it's pretty easy. First of all, you need to know 1) where your static libraries are placed and 2) their exact names. Go to project properties and then General .


1 Answers

You'll need to parse the "ConfigurationType" attribute in the .vcproj file. An attribute of the <VisualStudioProject><Configurations><Configuration> element. It is "2" for a DLL project, "4" for a static library project. Beware that different configurations can have different values for this attribute, albeit that this will be very unusual.

You in general reverse-engineer these things by making a copy of the .vcproj file, make a change in the Project + Property pages, use File + SaveAll and then compare the two .vcproj files to see what changed.

Do watch out a bit for putting a lot of effort into such an old version of Visual Studio. Eight years is a very long time in software engineering, especially so after the C++11 standard was released. The C++ project file format dramatically changed at VS2010, now a .vcxproj file that joined the rest of the languages in VS by supporting builds through MSBuild. You are bound to have to redo all this when you upgrade your VS version some day. Better do that now since it sure won't be any easier doing it later when you came to depend on your tool.

like image 121
Hans Passant Avatar answered Sep 30 '22 00:09

Hans Passant