Programmatically, using the EnvDTE namespace, you can investigate the Project.Kind property of the Visual Studio project.
However, if you're interested in a more detailed, the project specification file, i.e. the *.csproj, *.vbproj, among others describes the kind of the project in an XML way.