CompileAssemblyFromDom throws access denied exception

孤者浪人 提交于 2019-12-04 12:42:28

I get this working. The problem was that assemblyName was file name not path, so I changed

assemblyName = Path.Combine(Path.GetTempPath(), assemblyName);

And it start working!

I got same error, but AssemblyName didn't fix it for me. I was able to fix it by using TempFiles parameter. Also, for some reason it does not work in the temp path itself, only works when I create my own subfolder there.

string tempPath = Path.GetTempPath() + "\\mysubfolder";
Directory.CreateDirectory(tempPath);

var parameters = new CompilerParameters(includeAssemblies.ToArray())
                {                    
                    GenerateInMemory = true,
                    TempFiles = new TempFileCollection(tempPath)
                };
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!