题
我想dynamicaly编码使用的CodeDom.我可以载的其他集会,但我不能负荷System.Data.Linq.dll.我得到一个错误:
元数据文件'System.Data.Linq.dll'找不到
我的代码看起来像:
CompilerParameters compilerParams = new CompilerParameters();
compilerParams.CompilerOptions = "/target:library /optimize";
compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("mscorlib.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");
compilerParams.ReferencedAssemblies.Add("System.Data.Linq.dll");
任何想法?
解决方案
这可能是因为大会是存储在一个不同的位置比mscorlib。它应工作,如果你提供一个完整的路径给大会。最便捷的方式获得完整的道路是让。净装载机做你的工作。我会尝试这样的事情:
compilerParams.ReferencedAssemblies.Add(typeof(DataContext).Assembly.Location);
其他提示
这可能是一个愚蠢的答案,但是你一定的代码被上运行的机器。净框架3.5?
不隶属于 StackOverflow