Reputation: 889
I have a console Application and I need to occasionally launch a WPF form depending on the parameters. I and trying the following:
if (arg == "/C")
{
System.Windows.Application application = new System.Windows.Application();
application.Run(new EJConfig.MainWindow());
}
The problem is that when I go to add a reference to System.Windows, it doesn't show up in the list of .NET components, and without it I get the following error:
The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
Upvotes: 2
Views: 610
Reputation: 4951
Have you tried adding:
using System.Windows;
To the top of the c# file? You may also need these assemblies:
Assembly: PresentationFramework (in PresentationFramework.dll)
Assembly: PresentationCore (in PresentationCore.dll
Check it out here
Upvotes: 3
Reputation: 4862
you need to add the PresentationFramework
and PresentationCore
assemblies to your project.
The System.Windows.Application
class is located in the PresentationFramework assembly, but you'll also need PresentationCore for it to work.
source: http://msdn.microsoft.com/en-us/library/system.windows.application.aspx
Upvotes: 3
Reputation: 7591
You are probably missing additional references besides System.Windows. I don't know which are required. You could find out by creating a default application and check the references listed.
Upvotes: 1