2016-10-19 1 views
1

플러그인을 고객에게 배포하려고합니다. MEF, 가져 오기, 내보내기 특성을 사용합니다. 나는 익스포트를 사용하고 클라이언트는 그것을 임포트한다. 내 애플리케이션은 DevExpress XtraGrid, XtraEditors 및 기타 많은 DevExpress DLL (스크린 샷 참조), System.Data.Services를 사용한다. 이러한 모든 필수 DLL과 그 의존성을 제공한다는 점에서 플러그인은 여전히 ​​DevExpress.ExpressApp를 필요로하는 것으로 보입니다. DevExpress.ExpressApp 및 모든 다른 종속성은 확실히 필요하지 않습니다.이 DLL DevExpress.ExpressApp가로드되는 이유는 무엇입니까?

클라이언트가 FileNotFound 예외가 발생했다고 불평 한 이후로 필자는 자신의 플러그인을 가져 오기위한 테스트 프로젝트를 만들기로 결정했습니다. 이것은 그가 얻고있는 클라이언트 이론을 테스트하는 테스트 코드입니다.

System.IO.FileNotFoundException: Could not load file or assembly 'DevExpress.ExpressApp.v14.2, Version=14.2.7.0, 


Our Plugin 
    [Export(typeof (ISomething))] 
     public class MyClass : ISomething 
     { 

    } 
TESTER 
    class Program 
    { 
      [ImportMany] 
     public IEnumerable<ISomething> Somethings { get; set; } 
     static void Main(string[] args) 
     { 

      var rp = new Program(); 
      rp.Run(); 


     } 
     public void Run() 
     { 
      Compose(); 

     } 
     public void Compose() 
     { 
      try 
      { 
       AppDomain.CurrentDomain.FirstChanceException += FirstChanceHandler; 
       AggregateCatalog aggregatecatalogue = new AggregateCatalog(); 
       aggregatecatalogue.Catalogs.Add(new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory)); 
       CompositionContainer container = new CompositionContainer(aggregatecatalogue); 
       CompositionBatch batch = new CompositionBatch(); 
       batch.AddPart(this); 
       container.Compose(batch); 
      } 
      catch (Exception ex) 
      { 
       throw ex; 
      } 

     } 

     static void FirstChanceHandler(object source, FirstChanceExceptionEventArgs e) 
     { 
      System.Text.StringBuilder msg = new System.Text.StringBuilder(); 
      msg.AppendLine(e.Exception.GetType().FullName); 
      msg.AppendLine(e.Exception.Message); 
      System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(); 
      msg.AppendLine(st.ToString()); 
      msg.AppendLine(); 
      String desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); 
      string logFilePath = String.Format("{0}\\{1}", desktopPath, "logfile.txt"); 
      System.IO.File.AppendAllText(logFilePath, msg.ToString()); 

     } 

과연, 나는 출력 창에보고는 참으로이 DLL 및 GAC에서 ExpressApp 관련 종속성의 일부를로드하는 것을 알아 냈다. 질문 : ExpressApp이 필요한 곳과 이유를 어떻게 알 수 있습니까? 난 그냥 DLL을 제공 할 수 있습니다하지만 왜 그들이 필요할 것이라고 단서를 가지고 종속성의 톤에 대한 간다.

enter image description here

+0

문제를 해결하는 데 어떤 행운이 있습니까? – andrews

답변

1

는 관리되는 어셈블리의 종속성을 확인하기위한 도구가 있습니다. MS Windows SDK에는 ildasm.exe 유틸리티가 포함되어 있습니다. 기회는 당신이 이미 설치되어 있습니다에서 :

C : \ 프로그램 파일 마이크로 소프트의 SDK \ WINDOWS \ v8.0A \ 빈 \으로 netfx \ (86) 4.0 도구 \ Ildasm.exe를

나는 비슷한 문제가 있었다 (그것은 dll 버전 불일치였습니다.) 또한 명령 행에서 cygwin의 'grep'을 사용하여 누락 된 종속성 문자열을 모든 DX와 사용자 정의 어셈블리에서 검색하여 누락 된 종속성 dll 버전을 참조하는 실제 .dll 파일을 찾습니다. 그런 다음 ildasm.exe에서 열어 MANIFEST 트리 노드를 두 번 클릭합니다. 내가 가지고 있지 않은 .dll 버전에 대한 참조를 보았습니다.

누락 된 종속성을 추적하기 위해 동일한 단계를 수행 할 수 있습니다. 프로젝트의 bin 디렉터리에있는 모든 DX dll에 대해 "DevExpress.ExpressApp"문자열 검색을 실행 한 다음 결과가 발견되면 ildasm.exe로보고 된 파일을 엽니 다.

참고로 'grep'이 없습니다. https://www.cygwin.com/ 패키지가 설치되어 있으므로 사용할 수있는 문자열 검색 유틸리티를 사용하십시오.

dll 종속성을 검사하기위한 다른 타사 도구가 있지만 별도로 설치해야하며 ildasm.exe는 Windows SDK의 일부입니다. 다른 도구의 심판이 질문의 답변을 참조하십시오 :

How do I determine the dependencies of a .NET application?

UPDATE :

앱이 플러그인이며, DX libs와를 사용하기 때문에 당신은 bin 폴더에있는 모든 DX libs와이없는 경우 직접 GAC에서, 당신은 내 경우에는 바로 DX 설치 폴더에 DevExpress.ExpressApp 참조를 검색 할 수 있습니다

C : \의 Program Files (x86) \ DevExpress의 15.2 \ 구성 요소 \ 빈 \에게

프레임 워크

위의 폴더 내용을 임시 폴더에 복사하고 모든 로켈 하위 폴더는 물론 모든 DevExpress.ExpressApp를 제거했습니다.

grep -nr "DevExpress.ExpressApp" 

다음과 같은 결과 생산 : 위의 DLL이 중 하나가 플러그인 또는 플러그인에있는 호스트 응용 프로그램 중 하나에 의해 사용되는 경우

Binary file DevExpress.EasyTest.v15.2.dll matches 
Binary file DevExpress.Persistent.Base.v15.2.dll matches 
Binary file DevExpress.Persistent.BaseImpl.EF.v15.2.dll matches 
Binary file DevExpress.Persistent.BaseImpl.v15.2.dll matches 
Binary file DevExpress.Workflow.Activities.v15.2.Design.dll matches 
Binary file DevExpress.Workflow.Activities.v15.2.dll matches 

참조를 다음 * DLL 및이 명령을 실행 배치되어야한다.

HTH

+0

안녕하세요, 저는 운이 없었습니다. 팁 주셔서 감사합니다. 정말 고마워. 오 .. 이건 토 커야. 당신의 팁을 정말로 고맙게 생각합니다. – user575219

+0

나는 grep을 사용하고 누락 된 DLL이 될 문자열을 검색한다는 생각을 좋아합니다. 당신 말이 맞아요. 나는 ExpressApp이 Peristent.BaseImpl에 의해 사용된다는 것을 어떻게 든 알게되었습니다. 그러나 그 다음 나는주기를 알아 내기 위해 계속되었다. 왜 내가 BaseImpl이 필요한지 기억할 수 없다. 어쨌든 고마워요! – user575219

+0

BaseImpl은 플러그인/앱에서 직접 요청하지 않고 참조 목록에서 다른 DX lib를 요청할 수 있습니다. 내 대답을 수락하고 투표 해 주셔서 감사합니다! – andrews

관련 문제