Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify if an EXE is WPF

Tags:

winforms

wpf

I am trying to find out if an EXE is a WPF app or a WinForms app. Any suggestions on how I can go about this?

I have heard that I could use the Reflector tool, if so how would this be done?

Thanks.

like image 895
JamesM Avatar asked Jul 16 '09 08:07

JamesM


1 Answers

Although generally an application can be classed as 'either' a WPF or WinForms application, interoperability is possible such that a WinForms app can 'host' WPF controls and vice-versa. Since your application sounds like it references both sets of assemblies, it could be using both. Just something to be aware of.

Anyway, I've just opened one of my WPF projects in Reflector and some obvious indications it's a WPF application are:

1) There is an App class that has a StartupUri which is a Xaml file (like this)

public class App : System.Windows.Application
{
    // Methods
    [DebuggerNonUserCode]
    public void InitializeComponent()
    {
        base.StartupUri = new Uri("Window1.xaml", UriKind.Relative);
    }

2) There is a XamlGeneratedNamespace in the EXE

3) In the Resources 'folder' there are .baml files (probably within <Application1>.g.resources).

4) The window classes (if you can find them easily in the Reflector tree) implement:

public class Window1 : System.Windows.Window
, System.Windows.Markup.IComponentConnector {

If you really want to trawl through Reflector in detail, WinForms windows will inherit from System.Windows.Forms.Form so you can easily spot if you have both WinForms and WPF in there.

like image 134
Conceptdev Avatar answered Sep 24 '22 16:09

Conceptdev