플러그인을 고객에게 배포하려고합니다. 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을 제공 할 수 있습니다하지만 왜 그들이 필요할 것이라고 단서를 가지고 종속성의 톤에 대한 간다.
문제를 해결하는 데 어떤 행운이 있습니까? – andrews