app.config中的参考程序集 [英] Reference Assembly in app.config

查看:87
本文介绍了app.config中的参考程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道之前曾有人问过这个问题,但在此情况下不是这样!

I know this Question has been asked before but not in this Context!

我有一个WPF-Application(第三方),它使我可以添加XAML ResourceDictionary,因此我创建了一个带有实现ICommand接口的类的ClassLibrary 并在Execute-Method中调用WebService.

I have an WPF-Application(third party) that gives me the possibility to add an XAML ResourceDictionary, so I´ve created a ClassLibrary with a Class that Implements the ICommand Interface and calls a WebService in the Execute-Method.

现在我想将此命令附加到应用程序中的控件上!

Now I want to attach this Command to a Control in the Application!

这是我的ResourceDictionary:

This is my ResourceDictionary:

        <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失败...

So this works like charm, if I add my Custom.Test.dll to the GAC but if I try to reference the DLL from the app.config the CommandCall fails...

这是我在App.config中尝试引用程序集的内容:

Here is what I tried in the App.config to reference the Assembly:

<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就能使它正常工作?

Is there any possibility I can get this to Work without the need of putting my Custom DLL in the GAC?

对于RollingOut的应用程序,将引用添加到App.config中会容易得多...

For the RollingOut of the Application it would be much easier to have the refernce in the App.config...

推荐答案

您是否尝试将Custom.Test.DLL放在应用程序可执行文件所在的目录中?

Did you try putting Custom.Test.DLL in the same directory where application executable lives?

这篇关于app.config中的参考程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆