Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to determine if a launched application was built using .NET. I can use either C Sharp or VB.

What I have tried:

I found a solution on Stack Overflow, but the solution does not seem to work anymore. So I broke the solution method apart and did a Console.WriteLine() for each of the module names. The two modules that the solution looks for aren't listed and the modules that are loaded are: ntdll.dll, wow64.dll, wow64win.dll, wow64cpu.dll.
Any Help would be appreciated.
Posted
Updated 20-Feb-20 13:17pm

1 solution

Use ildasm.exe (third answer in the SO question you linked to).

Programmatically, you can try to load the assembly:
C#
public static bool IsAssembly(string absolutePath)
{
   try
   {
      Assembly assembly = Assembly.LoadFile(absolutePath);
      return true;
   }
   catch (Exception _)
   {
      return false;
   }
}
Assembly.LoadFile Method (System.Reflection) | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
LeMS_Studios 20-Feb-20 21:22pm    
I am looking for a boolean method, with the parameter either the file path or the process of the application. Something similar to the solution with 41 votes on SO.
phil.o 21-Feb-20 4:15am    
I edited my answer for a programmatical solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900