Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application.Current.Shutdown(); is defined in an assembly not referenced

I'm getting the error:

Error 1 The type 'System.Windows.Markup.IQueryAmbient' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

When doing the following:

public void ExitApplication()
{
    Application.Current.Shutdown();
}

The project is targeted to .NET 4.0, my Visual Studio is 2010, I tried adding

using System.Windows.Markup; with no succes, and

using System.Xaml; where Xaml doesn't exist in namespace System.

What should I do to fix this?

like image 706
Joetjah Avatar asked Mar 15 '13 14:03

Joetjah


3 Answers

Well ok, I guess your issue is solved when you add System.Xaml.dll as reference to your project. The interface is declared there. Here is the doc.

like image 141
DHN Avatar answered Sep 20 '22 03:09

DHN


Add System.Xaml.dll to project references.

like image 8
Antonio Bakula Avatar answered Sep 21 '22 03:09

Antonio Bakula


You need to add a reference to System.Xaml in your main application project. Using System.Xaml is not needed to be in your code.

like image 5
TimVK Avatar answered Sep 23 '22 03:09

TimVK