Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application is not supported in a Windows Presentation Foundation (WPF) project

Tags:

wpf

xaml

I've just created a new WPF project in the blend, pushed it on git, added mqsql drivers, rest service and nfc sdk and suddenly blend tells me that Application is not supported. The error leads me to App.xaml which is entirely unedited and looks like this:

<Application x:Class="desktop_client.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:desktop_client"
         StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>

The same error goes for practically any tag such as Style, Setter, ControlTemplate, Canvas, Path. nothing is supported. comparing both the xaml and the c# file to the other project I just finished which works just fine, there is no difference (other than namespace and the path, naturally)

I'm absolutely dumbfounded

like image 828
user3106891 Avatar asked Mar 19 '17 12:03

user3106891


3 Answers

Had same issue in VS. I closed and restarted VS and no longer got the error.

like image 126
dvdhns Avatar answered Nov 10 '22 02:11

dvdhns


Try adding the following references:

  • PresentationCore
  • PresentationFramework
  • WindowsBase

With the ReferenceManager in your project. The above references are the references used by wpf.

like image 43
MattFisch Avatar answered Nov 10 '22 03:11

MattFisch


So old, still occurs - to save time for others - this is the solution that works in VS-2019, as @"Andreas Forslöw" wrote:

Even easier: Right click the project in Solution explorer, click "Unload project". Then, when unloaded, right click again and click "Reload project". Worked for me! – Andreas Forslöw

like image 45
ShloEmi Avatar answered Nov 10 '22 03:11

ShloEmi