Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding icon on WPF XAML window causes error/crash VS2012

I found a bug in WPF XAML when specifying an icon for a XAML Window, trying to run the program generates an error message on the line:

 System.Windows.Application.LoadComponent(Me, resourceLocater)

XamlParseException occurred

Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '5' and line position '100'.

I've set the icon to Always Create on the Copy To Output Directory with no luck.
I changed the icon from Resource to EmbeddedResource - no luck there either.
I added it to the Resources for the project - still no luck.
I've verified the file and its location 100%.
The XAML of the window is correct, the name is correct, the path is correct.

Icon="Resources/VisualizerIcon.ico" 

Stumped - online forums say to Copy to output Directory is the solution, but, after building the solution, only the Folder is copied over (even though I explicitly set the ICO file to be copied).

Anyone?

like image 503
MC9000 Avatar asked Mar 12 '26 07:03

MC9000


1 Answers

You just need to set the build action for the actual image/icon to Resource as shown in the properties window..

enter image description here

I know it's an old post, just wanted to share a dummy error..

like image 191
ArchAngel Avatar answered Mar 14 '26 21:03

ArchAngel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!