이것은 매우 구체적인 질문입니다. 그러나 ASP.NET MVC 웹 응용 프로그램에 Silverlight 응용 프로그램 라이브러리를로드하여 형식을 반영하고 선택할 사용자 목록을 작성해야합니다. 이 응용 프로그램의 목적은 사용자가 사용자 정의 라이브러리를 업로드하고 "샌드 박스"환경에서 테스트 할 수있게하는 것입니다.리플렉션을 위해 ASP.NET MVC 웹 응용 프로그램에 Silverlight 라이브러리로드?
어쨌든 고생 끝에 ASP.NET MVC에서 파일 업로드를 수행했습니다. 나는 아무 소용이 프로젝트에 참조로 지정된 어셈블리를 추가 한
{"Cannot resolve dependency to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.":"System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"}
: 나는 반성 업로드 된 어셈블리를로드 할 때 지금, 나는 다음과 같은 오류가 발생합니다.
Assembly a = Assembly.ReflectionOnlyLoad(_toolBytecode);
foreach (Type t in a.GetTypes())
{
if (typeof(BoardTool).IsAssignableFrom(t))
{
if (t.IsSubclassOf(typeof(NetworkTool)))
{
// Loop through each attribute of the class
foreach (object attr in t.GetCustomAttributes(false))
// Check if the attribute is the one we want
if (attr is NetworkToolIDAttribute)
{
ReflectedTool rt = new ReflectedTool();
rt.ToolID = ((NetworkToolIDAttribute)attr).ToolID;
rt.ToolName = t.Name;
_tools.Add(rt);
}
}
else
{
ReflectedTool rt = new ReflectedTool();
rt.ToolID = Guid.Empty;
rt.ToolName = t.Name;
_tools.Add(rt);
}
}
}
어떤 도움 apprecited 될 것이다, 또는 당신이 할 수있는 또 다른 방법을 알고 있다면, 그건 너무 좋은 것 : 어셈블리를 반영하기 위해
코드는 다음과 같습니다. 다른 모든 방법이 실패 할 경우 샌드 박스 실행기/컨테이너를 빠른 Silverlight 응용 프로그램으로 작성하게 될 것입니다.
미리 감사드립니다.