views:

41

answers:

1

I would like to identify the language(C#, VB, whatever) used to create a particular assembly.

I would also like to identify the compiler (the MS one, mono).

There doesn't seem to be any information in the assembly. The section about the headers of an assembly in Ecma-335 partition II doesn't mention anything useful.

I wonder if there are fingerprints in an assembly that could reveal that "aha this is something very particular to C#/the c# compiler, you were written in C#!"

This would be useful to know for the static analysis tool I'm writing.

+1  A: 

This is by design, an assembly stores metadata and IL, information that's language neutral. So that you can easily mix and match code written in different languages. Very nice .NET feature.

The are hints though. A VB.NET programmer is likely to use VB.NET specific language features that are implemented in a helper assembly in the .NET framework. Like the My namespace and conversion operators like CType. Open the assembly with Ildasm.exe and look at the manifest for the .assembly directives. If you see one for Microsoft.VisualBasic then the odds are very high that this was written in VB.NET. If it is missing then good odds for C#, although not conclusive. If you look at the class list and see <CppImplementationDetails> at the top then you know for sure it was written in C++/CLI.

Make sure you don't actually care about this.

Hans Passant