错误继续。桌面应用程序代码:
private void LoadAssemblys()
{
var dir = System.AppDomain.CurrentDomain.BaseDirectory;
Assembly MyHomeAssembly=Assembly.LoadFrom(dir + "/MyHome.dll");
System.Type[] types = MyHomeAssembly.GetTypes();
System.Type primaryTyp = types[0];
foreach (System.Type t in types)
{
if (t.Name == "MyHomePage")
{
var obj = MyHomeAssembly.CreateInstance("MyHome.MyHomePage", true);
}
}
}
dll 是一个带有 xaml 代码的简单类库项目:
<Page
x:Class="MyHome.MyHomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:MyHome"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid>
</Grid>
</Page>
错误:Microsoft.UI.Xaml.Markup.XamlParseException:“XAML”