2012-01-12 3 views
0

I 프로덕션 사이트에 RuleSetDialog 양식을 엽니 다하기 위해 노력하고있어하지만이 메시지와 함께 충돌 :RuleSetDialog 및 참조 된 어셈블리

FileNotFoundException: Could not load file or assembly 'IBM.Data.Informix, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. The system cannot find the file specified. 
것은,이 어셈블리는 우리의 프로젝트에서 참조하지만, 아무튼되고있다

다른 데이터베이스가 사용되기 때문에 프로덕션 사이트에 존재하지 않습니다.

at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
at System.Reflection.Assembly.Load(AssemblyName assemblyRef) 
at System.Workflow.Activities.Rules.SimpleRunTimeTypeProvider.get_ReferencedAssemblies() 
at System.Workflow.Activities.Rules.SimpleRunTimeTypeProvider.GetTypes() 
at System.Workflow.Activities.Rules.Parser..ctor(RuleValidation validation) 
at System.Workflow.Activities.Rules.Design.RuleSetDialog..ctor(Type activityType, ITypeProvider typeProvider, RuleSet ruleSet) 

내가 할 모르겠어요 :

는 스택 추적입니다. 우리 머신에는 모든 드라이버가 설치 되었기 때문에 모든 것이 개발 및 테스트 과정에서 잘 작동했지만 필요한 드라이버 만 설치하는 사용자에게는 그렇지 않습니다.

+0

당신이 이것에 대한 해결 방법을 발견했다? – czuroski

답변

1

필요한 dll이 응용 프로그램의 기본 폴더에 있지만 별도의 하위 폴더에 배포되어 있으므로 이번 주에 비슷한 오류가 발생했습니다. RuleEngine에게 어디에서 검색 할지를 알리는 작업 방법을 찾지 못했습니다. AppDomain 해킹은 나에게 가장 좋은 해결책으로 보지 못했습니다.

제 경우에는 RuleEngine을 실행하는 데 사용하는 개체에 확장 메서드가 없으므로 해당 메서드 정의에 대해 참조 된 어셈블리를 직접 사용하지 않습니다. 참조 된 어셈블리는 규칙 유효성 검사에 필요하지 않습니다.

제 해결 방법은 규칙 엔진에 참조 된 어셈블리가 없다는 것입니다. 이 작업은 자체 ITypeProvider를 작성하고이를 RuleEngine/RuleSetDialog 생성자의 생성자에 전달하여 수행했습니다.

나는 ( https://github.com/rashiph/DecompliedDotNetLibraries/blob/master/System.Workflow.Activities/System/Workflow/Activities/Rules/SimpleRunTimeTypeProvider.cs) GitHub의에서 기본 SimpleRunTimeTypeProvider의 코드를 가져다가 다음과 같이 속성 ReferencedAssemblies (4 LOC 댓글을 달았) 적응 :

public ICollection<Assembly> ReferencedAssemblies 
    { 
     get 
     { 
      if (this.references == null) 
      { 
       List<Assembly> list = new List<Assembly>(); 
       // ADAPTATION TO ORIGINAL SOURCE: tell the RuleEngine that there are no referenced assemblies and hence no Extension Methods 
       //foreach (AssemblyName name in this.root.GetReferencedAssemblies()) 
       //{ 
       // list.Add(Assembly.Load(name)); 
       //} 
       this.references = list; 
      } 
      return this.references; 
     } 
    } 
+0

Brilliant. 나는이 문제를 직접 해결 한 적이 없다. 설치 패키지에 더 많은 dll 파일을 쉽게 압축 할 수있었습니다. 고마워,이 실제로 몇 가지 다른 문제를 해결합니다. – Nezreli

1

나는 이것이 가장 정확한 솔루션입니다 생각하지 않습니다,하지만 난 내 응용 프로그램이 추가 작업을 할 수 있습니다 :이 사람을 도울 수

var currentDomain = AppDomain.CurrentDomain; 
currentDomain.AssemblyResolve += (o, args) => 
{ 
    // I resolve the not found assemblies here. 
} 

희망.