'System.IO.IOException' 类型的异常

Exception of type 'System.IO.IOException'

我收到以下错误消息:

An unhandled exception of type 'System.IO.IOException' occurred in PresentationFramework.dll

Additional information: Cannot locate resource 'Sections/MainWindow.xaml'.

我创建了文件夹,然后将我的 MainWindow.xaml 移到了名为 Sections 的文件夹中。我收到错误,然后发现这里已经存在关于确保将 starupURI 更改为 Sections/mainwindow.xaml

的问题

但是我仍然收到错误消息,我不知道为什么。

编辑:所以我再次 运行 代码,没有做任何更改,现在我得到了这个

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '5' and line position '54'.

我在那个位置的代码:

<Window x:Class="CTaC_Information_System.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStartupLocation="CenterScreen"
        Title="CTaC Information System" Height="828" Width="1486.5" Icon="AISLogov2.ico" Loaded="Window_Loaded" FontFamily="Georgia">

红线在 > 下方。我走到代码的末尾并添加了 </Window> 因为出于某种原因我仍然收到错误消息。

非常感谢所有帮助。

我认为第二个错误是由您的图标引起的。尝试删除那部分代码并重新编译以检查是否可以隔离问题。您可以尝试将图标图像更改为 .png 而不是 .ico.

对我来说,当我将 类 MainWindows.xamlApp.xaml 从根文件夹到 /UI 文件夹。

当我将它们移回后 - 一切都恢复正常,错误消失了。