wpf - 在调试和构建 WPF 应用程序时遇到问题
问题描述
我一直在对我们几年前使用 ModernUI 框架编写的 WPF 应用程序进行修改,添加一个共享项目,进行必要的更改。但是,我发现我既不能调试应用程序,也不能构建它。当我尝试调试应用程序时,我收到此错误:
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'.
我在整个项目中搜索。在几个 ModernWindow 中有两个地方有那个 .ico 文件的 Icon 属性的值。但是,我将其更改为:
<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"
>
所以,我不知道还能去哪里看,因为搜索整个解决方案并没有显示类似 assets/14546169_s-01.ico 的任何内容,而我已将 2 个 .xaml 文件更改为 /assets/14546169_s-01 .ico。
如果我尝试构建它,其余的就更奇怪了。它告诉我的只是
Unknown build error, 'An item with the same key has already been added.'
它唯一说的是问题出在 LRAT 项目中。没有提到文件。
我们从 VS 2017 开始这个项目。我在那里得到了错误。我也通过 VS 2019 获得它们。
解决方案
推荐阅读
- perl - 如何在 Perl 中解析多行记录?
- java - Javafx 图表中的错误:添加了重复系列。为什么?
- .net - vb.net 3.5 - 在屏幕键盘上编写其他进程
- docker - 在安装在 docker 下的 nfs 上提供 http 内容
- mysql - SQL 日期不是相对的
- reactjs - 如果组件在状态中接收到相同的值,是否会重新渲染组件
- php - 在 IE 中无法读取 Cookie
- java - 在 JPA 中选择日期范围
- python - 我正在尝试在 Python 中使用 imaplib 从服务器获取电子邮件,但它没有打印任何内容
- squish - 是否有停止在 squish 中运行的捷径?