2013-06-24 30 views
2

我知道这个问题以前已经问过,但在这个环境中没有问过!app.config中的引用程序集

我,让我补充一个XAML ResourceDictionary中的可能性的WPF的应用程序(第三方),所以从来就创造了一个ClassLibrary与它实现了ICommand接口 并调用执行法WebService的一类。

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

这是我的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失败...

以下是我在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> 

是否有可能我能得到这个,而不需要把我的自定义工作GAC中的DLL?

因为这将有在App.config的refernce更容易应用的RollingOut ...

回答

2

你尝试把Custom.Test.DLL在同一个目录下的应用程序可执行的生活?

+0

没有没有尝试过......如果我把它放在同一个目录下,我该如何引用app.config中的文件? – makim

+0

甚至没有必要在app.config中引用该文件,只需将它放在同一个目录中即可使用! 没想到那么简单^^谢谢 – makim

+2

不客气。 WPF只是试图加载程序集,如果你在代码中执行Assembly.Load(name),它也是一样。 .NET程序集加载器被称为“Fusion”。加载过程从应用程序目录开始,然后经过一堆其他地方并在GAC中结束。 Google“.NET Fusion”。 –