2

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

makim
  • 3,154
  • 4
  • 30
  • 49

1 Answers1

2

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

Ivan Krivyakov
  • 1,898
  • 1
  • 17
  • 27
  • no did not try that...how do I have to reference the File in the app.config if I put it in the same directory? – makim Jun 24 '13 at 20:25
  • didn´t even have to reference the file in the app.config, just put it in the same Directory and it works! Did not think that it's so simple^^ Thanks – makim Jun 24 '13 at 20:29
  • 2
    You're welcome. WPF just tries to load the assembly, same if you did Assembly.Load(name) in code. .NET assembly loader is called "Fusion". The loading process starts with the application directory, then goes through a bunch of other places and ends in the GAC. Google ".NET Fusion". – Ivan Krivyakov Jun 24 '13 at 20:49