Reference Assembly in app.config

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 03:33:01

问题


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

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!

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>

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

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>

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

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


回答1:


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



来源:https://stackoverflow.com/questions/17284343/reference-assembly-in-app-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!