我知道这个问题以前被问过,但在这个上下文中没有!
我有一个WPF应用程序(第三方),它允许我添加XAML ResourceDictionary,所以我创建了一个ClassLibrary,其中包含一个实现ICommand接口的类并在Execute方法中调用WebService。
现在我想将此命令附加到应用程序中的控件!
这是我的资源字典:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iet="clr-namespace:iETSolutions.Enterprise.WorkCenter.Controls;assembly=iETSolutions.Enterprise.WorkCenter.Controls"
xmlns:custom="clr-namespace:Custom.Test;assembly=Custom.Test">
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Name}" Value="SearchButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Button Command="{StaticResource cmd}" CommandParameter="{Binding ElementName=SearchTextBox, Path=Text}">
<Image Source="pack://application:,,,/iETSolutions.Enterprise.WorkCenter;component/Images/PNG/iET_search.png" />
</Button>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
因此,如果我将Custom.Test.dll添加到GAC,但如果我尝试从app.config引用dll,CommandCall将失败,这就像魅力一样。。。
以下是我在App.config中尝试引用程序集的内容:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Custom.Test" publicKeyToken="314daa73fc3fb7cf" culture="neutral"/>
<codeBase version="1.0.0.0" href="http://localhost/Custom/Custom.Test.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
我有没有可能在不需要将我的自定义DLL放入GAC的情况下让它发挥作用?
对于应用程序的RollingOut,在App.config…中引用会容易得多
您是否尝试将Custom.Test.DLL放在应用程序可执行文件所在的同一目录中?