System.Windows.Markup.XamlParseException:“'xxxx 'System.Windows.ResourceDictionary.DeferrableContent' ”FileNotFoundException: Could not load file or assembly 'Syncfusion.SfInput.Wpf, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89'. |
Codes as follow:
// LoginCommand.cs using AutocadR25Plugin2; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; using System.Windows; using WpfApp1; using Application = Autodesk.AutoCAD.ApplicationServices.Application; [assembly: CommandClass(typeof(R25Plugin.LoginCommand))] namespace R25Plugin { public class LoginCommand { [CommandMethod("Show")] public void ShowLoginForm() { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("xxx/xxxxx/VkY="); Document doc = Application.DocumentManager.MdiActiveDocument; DataGrid1 dataGrid1 = new DataGrid1(); dataGrid1.Show(); } } } |
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0-windows</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <PlatformTarget>x64</PlatformTarget> <UseWPF>true</UseWPF> <UseWindowsForms>true</UseWindowsForms> </PropertyGroup> <ItemGroup> <FrameworkReference Include="Microsoft.WindowsDesktop.App" /> </ItemGroup> <ItemGroup> <PackageReference Include="AutoCAD.NET" Version="25.0.1" /> <PackageReference Include="Microsoft.Identity.Client" Version="4.68.0" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="RestSharp" Version="112.1.0" /> <PackageReference Include="Syncfusion.SfGrid.WPF" Version="27.2.2" /> <PackageReference Include="Syncfusion.Shared.WPF" Version="27.2.2" /> <PackageReference Include="Syncfusion.SfInput.WPF" Version="27.2.2" /> <PackageReference Include="Syncfusion.Tools.WPF" Version="27.2.2" /> </ItemGroup> <!-- Change the paths to the targeted AutoCAD libraries --> <ItemGroup> <Reference Include="accoremgd"> <HintPath>D:\Programs\AutoDesk\CDROM1\inc\AcCoreMgd.dll</HintPath> </Reference> <Reference Include="Acdbmgd"> <HintPath>D:\Programs\AutoDesk\CDROM1\inc\AcDbMgd.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="acmgd"> <HintPath>D:\Programs\AutoDesk\CDROM1\inc\AcMgd.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup> <ItemGroup> <Resource Include="Assets\Employee.png" /> <Resource Include="Assets\Insufficient.png" /> <Resource Include="Assets\location.png" /> <Resource Include="Assets\Perfect.png" /> <Resource Include="Assets\Sufficient.png" /> <Resource Include="Resources\icon16.png" /> <Resource Include="Resources\icon32.png" /> </ItemGroup> <ItemGroup> <Compile Update="DataGrid1.xaml.cs"> <SubType>Code</SubType> </Compile> <Compile Update="LoginWindow.xaml.cs"> <SubType>Code</SubType> </Compile> <Compile Update="Properties\Resources.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>Resources.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <ItemGroup> <None Update="start.scr"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> <ItemGroup> <Using Include="Autodesk.AutoCAD.ApplicationServices.Core" /> <Using Include="Autodesk.AutoCAD.DatabaseServices" /> <Using Include="Autodesk.AutoCAD.EditorInput" /> <Using Include="Autodesk.AutoCAD.Geometry" /> <Using Include="Autodesk.AutoCAD.Runtime" /> <Using Include="System.Math"> <Static>True</Static> </Using> </ItemGroup> <Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Exec Command="copy $(OutputPath) "D:\Programs\AutoDesk\AutoCAD 2025\Support"" /> </Target> </Project> |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using WpfApp1.ViewModel; namespace WpfApp1 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class DataGrid1 : Window { public DataGrid1() { InitializeComponent(); } } } |
<Window x:Class="WpfApp1.DataGrid1" 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:syncfusion="http://schemas.syncfusion.com/wpf" xmlns:vm="clr-namespace:WpfApp1.ViewModel" xmlns:Converters="clr-namespace:WpfApp1.Converters" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp1" mc:Ignorable="d" Title="DataGrid1" Height="450" Width="800" WindowState="Maximized"> <Window.Resources> <vm:EmployeeViewModel x:Key="viewModel" /> <Converters:SelectedImageConverter x:Key="selectedImageConverter" /> <Converters:StringToImageConverter x:Key="trustImageConverter" /> <Style TargetType="syncfusion:SfRating"> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="Width" Value="130"/> <Setter Property="Height" Value="40"/> </Style> <Style TargetType="syncfusion:SfRatingItem"> <Setter Property="Padding" Value="1"/> </Style> </Window.Resources> <Window.DataContext> <StaticResource ResourceKey="viewModel"/> </Window.DataContext> <Grid Width="1098" Height="600"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="160"/> </Grid.ColumnDefinitions> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <syncfusion:SfDataGrid AllowEditing="True" AllowFiltering="True" AllowSorting="True" AllowGrouping="True" ShowGroupDropArea="True" SelectionMode="Extended" HeaderLinesVisibility="Both" GridLinesVisibility="Both" ColumnSizer="Auto" AutoGenerateColumns="False" x:Name="dataGrid" HeaderRowHeight="25" ItemsSource="{Binding ElementName=sfDataPager,Path=PagedSource}"> <syncfusion:SfDataGrid.Columns> <syncfusion:Columns> <syncfusion:GridTemplateColumn Padding="2" HeaderText="Employee Name" MappingName="EmployeeName"> <syncfusion:GridTemplateColumn.CellTemplate> <DataTemplate> <Grid Margin="3"> <Grid.ColumnDefinitions> <ColumnDefinition Width="15" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Width="15" Height="15" Source="{Binding Gender, Converter={StaticResource selectedImageConverter}}" /> <TextBlock Grid.Column="1" Padding="4" VerticalAlignment="Center" Text="{Binding EmployeeName}" /> </Grid> </DataTemplate> </syncfusion:GridTemplateColumn.CellTemplate> </syncfusion:GridTemplateColumn> <syncfusion:GridTextColumn HeaderText="Designation" Padding="0" MappingName="Designation" TextTrimming="CharacterEllipsis" /> <syncfusion:GridTextColumn HeaderText="Mail" Padding="0" MappingName="Mail" TextTrimming="CharacterEllipsis" /> <syncfusion:GridTemplateColumn Width="100" HeaderText="Location" MappingName="Location"> <syncfusion:GridTemplateColumn.CellTemplate> <DataTemplate> <Grid Margin="3"> <Grid.ColumnDefinitions> <ColumnDefinition Width="15" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Width="15" Height="15" Source="Assets/location.png" /> <TextBlock Grid.Column="1" Padding="4" VerticalAlignment="Center" Text="{Binding Location}" /> </Grid> </DataTemplate> </syncfusion:GridTemplateColumn.CellTemplate> </syncfusion:GridTemplateColumn> <syncfusion:GridTemplateColumn HeaderText="Trust Worthiness" MappingName="Trustworthiness"> <syncfusion:GridTemplateColumn.CellTemplate> <DataTemplate> <Grid Margin="3"> <Grid.ColumnDefinitions> <ColumnDefinition Width="15" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Width="15" Height="15" Source="{Binding Trustworthiness, Converter={StaticResource trustImageConverter}}" /> <TextBlock Grid.Column="1" Padding="4" VerticalAlignment="Center" Text="{Binding Trustworthiness}" /> </Grid> </DataTemplate> </syncfusion:GridTemplateColumn.CellTemplate> <syncfusion:GridTemplateColumn.EditTemplate> <DataTemplate> <syncfusion:ComboBoxAdv ItemsSource="{Binding Trustworthiness, Source={StaticResource viewModel}}" SelectedValue="{Binding Trustworthiness}" /> </DataTemplate> </syncfusion:GridTemplateColumn.EditTemplate> </syncfusion:GridTemplateColumn> <syncfusion:GridTextColumn Width="90" DisplayBinding="{Binding Path=Salary, StringFormat='{}{0:C}'}" HeaderText="Salary" TextAlignment="Right" /> <syncfusion:GridTextColumn HeaderText="Address" Padding="0" MappingName="Address" TextTrimming="CharacterEllipsis" /> </syncfusion:Columns> </syncfusion:SfDataGrid.Columns> </syncfusion:SfDataGrid> <syncfusion:SfDataPager x:Name="sfDataPager" Margin="30" Grid.Row="1" PageSize="17" Source="{Binding EmployeeDetails}" /> </Grid> </Grid> </Window> |
Any suggestion?
Syncfusion.SfInput.WPF.dll was already placed at the directory
same
with other dll files
Here is my operating progress:
1 Create a sample wpf project with Syncfusion WPF Extension in visual studio 2022. Simply choose a datagrid controll for test.
2 Generate wpf project, and work fine, a datagrid shows up.
3 Create a sample autocad addon project in the same solution, and surely it work well.
4 Add sample wpf project as a reference into autocad addon project, then add calling code to show datagrid
DataGrid1 dataGrid1 = new DataGrid1();
dataGrid1.Show();
5 Manually add all dlls in $CAD_HOME\support, which generated at step 2, then Debug autocad addon project, bug error emitted!
Syncfusion.Data.WPF.dll
Syncfusion.Licensing.dll
Syncfusion.SfGrid.WPF.dll
Syncfusion.SfInput.WPF.dll
Syncfusion.Shared.WPF.dll
Syncfusion.Tools.WPF.dll
If i switch the wpf sample project to Winform controlls with same version, then it work fine.
Plus Info:
AutoCAD.net: 25.0.1
WPF Controlls: all 27.2.2
framework: .net 8.0
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> |
Following is error statck details.
System.Windows.Markup.XamlParseException: '設定屬性 'System.Windows.ResourceDictionary.DeferrableContent' 時擲回例外狀況。' 行號 '12' 和行位置 '6'。 ---> System.IO.FileNotFoundException: Could not load file or assembly 'Syncfusion.SfInput.Wpf, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89'. 系统找不到指定的文件。 File name: 'Syncfusion.SfInput.Wpf, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' at System.Reflection.RuntimeAssembly.<InternalLoad>g____PInvoke|49_0(NativeAssemblyNameParts* __pAssemblyNameParts_native, ObjectHandleOnStack __requestingAssembly_native, StackCrawlMarkHandle __stackMark_native, Int32 __throwOnFileNotFound_native, ObjectHandleOnStack __assemblyLoadContext_native, ObjectHandleOnStack __retAssembly_native) at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly bamlAssembly) at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType) at System.Windows.Baml2006.Baml2006SchemaContext.GetClrType(Int16 typeId) at System.Windows.Baml2006.Baml2006Reader.Process_DefAttributeKeyType() at System.Windows.Baml2006.Baml2006Reader.ReadKeys() at System.Windows.ResourceDictionary.SetDeferrableContent(DeferrableContent deferrableContent) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value) --- End of inner exception stack trace --- at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, 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 WpfApp1.DataGrid1.InitializeComponent() in D:\workspaces\cad\TemplateDemo2\AutocadR25Plugin2\R25Plugin\DataGrid1.xaml:line 1 at WpfApp1.DataGrid1..ctor() in D:\workspaces\cad\TemplateDemo2\AutocadR25Plugin2\R25Plugin\DataGrid1.xaml.cs:line 25 at R25Plugin.LoginCommand.ShowLoginForm() in D:\workspaces\cad\TemplateDemo2\AutocadR25Plugin2\R25Plugin\LoginCommand.cs:line 19 at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke() |