動的に生成/コンパイルされたアセンブリをシリアル化してSQLに格納し、その後アセンブリを抽出して使用しようとしています。しかし、私は私を狂わせているエラーにぶつかっています。
「ファイルまたはアセンブリを読み込めませんでした'<ランダムコード>、Version = 0.0.0.0、Culture = neutral、PublicKeyToken=null'またはその依存関係の1つ。指定されたファイルが見つかりません。」
アセンブリを非シリアル化しようとすると。ポインタをいただければ幸いです。部分コード:
'--------------------------------------------------------------
'This section SUCCESSFULLY Compile & Execute the Dynamic Code
' vsResult returns ok.
' **Note: This is partial code to create the compiler.
'--------------------------------------------------------------
Dim voCompileResults As System.CodeDom.Compiler.CompilerResults = voCompiler.CompileAssemblyFromSource(voCompilerParams, sb.ToString)
Dim voAssembly As Reflection.Assembly = voCompileResults.CompiledAssembly
Dim voInstance As Object = Activator.CreateInstance(voAssembly.GetType("libARules.clsMyRoutine"), {New libARules.Sys.clsInterProcessData(New System.Xml.XmlDocument), New libArrowOps.clsDBAccess})
Dim vsResult As String = voInstance.GetType().InvokeMember("Run", Reflection.BindingFlags.InvokeMethod, Nothing, voInstance, Nothing)
'----------------------------------------------------
'Attempt to Serialize the Assembly for store/forward
'----------------------------------------------------
Dim voMemStream As New IO.MemoryStream
Dim voBF As New Runtime.Serialization.Formatters.Binary.BinaryFormatter
voBF.AssemblyFormat = Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple
voBF.Serialize(voMemStream, voCompileResults.CompiledAssembly)
'--------------------------------------
'Reset the MemoryStream position to begining
'--------------------------------------
voMemStream.Position = 0
'--------------------------------------
'Attempt to De-Serialize the MemoryStream back to an assembly
'--------------------------------------
voBF = New Runtime.Serialization.Formatters.Binary.BinaryFormatter
voBF.AssemblyFormat = Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple
voAssembly = voBF.Deserialize(voMemStream)
'----- **Error Here** ---------------------------------
エラーこの時点で:行でvoAssembly = voBF.Deserialize(voMemStream)
ファイルまたはアセンブリを読み込めませんでした'...<ランダムコード>...、Version = 0.0.0.0、Culture = neutral、PublicKeyToken=null'またはその依存関係の1つ。指定されたファイルが見つかりません。