динамическое выполнение кода
От: -rsdn- Беларусь http://dsalodki.wix.com/resume
Дата: 06.03.14 12:45
Оценка:
передаю строку кода в WinForms

private void btnRun_Click(object sender, EventArgs e)
        {
            CompilerParameters cp = new CompilerParameters();
            cp.GenerateInMemory = true;
            string[] assemblies = new string[0];//new[] {Assembly.GetExecutingAssembly().Location};
            CompilerResults results = new CSharpCodeProvider().CompileAssemblyFromSource(cp, tbCode.Text);
            object obj = results.CompiledAssembly.CreateInstance("instance");
            IRunable run = (IRunable)obj;
            string result = run.Run();
            lblResult.Text = result;
        }


получаю исключение
Could not load file or assembly 'file:///C:\Users\myName\AppData\Local\Temp\zuqtpnlz.dll' or one of its dependencies. The system cannot find the file specified.

zuqtpnlz.dll по указаному пути нету

как выполнить код выше?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.