Application.ProductName equivalent in WPF?
You can use Assembly.GetEntryAssembly()
to get the EXE assembly, and can then use Reflection to get the AssemblyProductAttribute from that.
This assumes that the product name has been set on the EXE assembly. The WinForms Application.ProductName
property actually looked in the assembly containing the main form, so it works even if the GUI is built in a DLL. To replicate this in WPF you would use Application.Current.MainWindow.GetType().Assembly
(and again use Reflection to get the attribute).
Here is another solution that I am using to get the Product Name
Public Shared Function ProductName() As String
If Windows.Application.ResourceAssembly Is Nothing Then
Return Nothing
End If
Return Windows.Application.ResourceAssembly.GetName().Name
End Sub