0

I've been making modifications to a WPF app we wrote a few years ago using the ModernUI framework, adding a Shared Project, making the necessary changes. However, I've found that I can neither debug the app, nor build it. When I tried to debug the app I get this error:

System.Windows.Markup.XamlParseException
  HResult=0x80131501
  Message='Provide value    on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '7' and line position '19'.
  Source=PresentationFramework
  StackTrace:
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at LRAT.MainWindow.InitializeComponent() in D:\Src\LRAT\Labor Relations Action Tracker (LRAT)\LRAT\LRAT\MainWindow.xaml:line 1

Inner Exception 1:
IOException: Cannot locate resource 'assets/14546169_s-01.ico'.

I've searching throughout the project. There were two places in a couple of ModernWindow which had that .ico file the value of the Icon property. However, I changed it to be like this:

<mui:ModernWindow x:Class="LRAT.MainWindow"                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mui="http://firstfloorsoftware.com/ModernUI"
              xmlns:view="clr-namespace:LRAT.View"
              xmlns:uc="clr-namespace:LRAT.UserControls"
              Style="{StaticResource BlankWindow}"    
              Closing="ModernWindow_Closing"
              Icon="/Assets/14546169_S-01.ico" 
              Loaded="ModernWindow_Loaded" 
    >

So, I don't know where else to look, since searching through the whole solution didn't show anything like assets/14546169_s-01.ico, whereas I've changed the 2 .xaml files to be /assets/14546169_s-01.ico.

If I try to build it, the rest is even weirder. All it tells me is

Unknown build error, 'An item with the same key has already been added.'

The only thing it says is that the problem is in the LRAT project. No file is mentioned.

We started this project with VS 2017. I get the errors there. And I get them with VS 2019, too.

Rod
  • 4,107
  • 12
  • 57
  • 81
  • Difficult to make it worse than not compiling at all. Try just removing any Icon = line completely. That will be looking for the ico in the main entry solution since it's not a pack url. Is it there? In the assets folder? Check the properties You want Build Resource Do Not Copy. Where's the other xaml file references that ico - is it in the shared project? You get that error on startup? It's loading just mainwindow on startup? – Andy Apr 12 '19 at 08:29
  • Removing the assignment of the ico file from the 2 XAML files, has changed it. I still can't debug (still getting the "item with the same key has already been added") error msg. But it looks like I can build it. The .ico file is in the Assets folder of the main project, not in the Shared Project. It does error on startup, in mainwindow, when I'm trying to debug. Don't understand why you suggest changing the .ico's Copy to Output; I would think that's exactly what I'd want to do. However, it is current set to Do Not Copy. – Rod Apr 12 '19 at 14:59
  • Rod. I said Do Not Copy. – Andy Apr 12 '19 at 15:11
  • Like I said, the .ico file is already currently set to Do Not Copy. – Rod Apr 12 '19 at 17:57

0 Answers0