hey ...
i used this code to compile a source in run time.
Microsoft.CSharp.CSharpCodeProvider cscp = new Microsoft.CSharp.CSharpCodeProvider();
System.CodeDom.Compiler.CompilerParameters cp = new System.CodeDom.Compiler.CompilerParameters();
cp.ReferencedAssemblies.Add("System.dll");
cp.ReferencedAssemblies.Add("AxInterop.MSTSCLib.dll");
cp.ReferencedAssemblies.Add("Microsoft.CSharp.dll");
cp.ReferencedAssemblies.Add("Interop.MSTSCLib.dll");
cp.GenerateInMemory = false;
cp.GenerateExecutable = true;
cp.OutputAssembly = "chilProgram.exe";
System.CodeDom.Compiler.CompilerResults cr = cscp.CompileAssemblyFromSource(cp,"SomeCodeToCompile");
everything is good , but when i run the child program it will give me this error for activex control named "Interop.MSTSCLib.dll" :
Unhandled exception : System.BadImageFormatException : Could not load file or assembly 'Interop.MSTSCLIP, Version=1.0.0.0 ,Culture neutral, PublicKeyToken=null' or one of dependencies. An attempt was made to load a program with an incorrect format.
what is the problem? is it possible problem be about PublicKeyToken=null? or adding a activex control to references has another way?
<edit> i have new error i cant invoke any property in the dll
very thanks!