我有一个WPF项目,我的MainView加载正常 . 我可以在我的视图中添加控件而没有任何问题 . 在我的一个控件中,我引用了一个外部项目的控件(在这个项目中引用),当我将该控件添加到XAML中时,XAML会看到正确的项目 . 该控件位于WPF自定义控件库中 . 但是,每次运行它都会出现此错误 .
无法加载文件或程序集“xxxControl,PublicKeyToken = null”或其依赖项之一 . 系统无法归档指定的文件 .
因为我过去做过这件事,所以我对此感到茫然 . 该项目是x64,我也控制了x64 .
<UserControl x:Class="Project.Views.LayoutViews.ColorScaleItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
**xmlns:testC="clr-namespace:TestControl;assembly=TestControl"**
xmlns:local="clr-namespace:Project.Views.LayoutViews"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MaxWidth="20"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<testC:TestControl1 Grid.Row="1" Grid.Column="1"></testC:TestControl1>
</Grid>
</UserControl>
1 回答
请检查您用于这些项目的.NET框架 . 确保您的消费者应用程序使用更高/更新或相同的版本,其中另一个被引用 .