繁体   English   中英

CompileAssemblyFromSource 返回错误“编译表达式:无法打开 c:\Users\*”以读取 'c:\Users\* 不是有效的 Win32 资源文件

[英]CompileAssemblyFromSource returns error “Compiling Expression: cannot open c:\Users\*” for reading 'c:\Users\* is not a valid Win32 resource file

我的应用程序生成并编译代码运行时:

CompilerParameters m_cp = new CompilerParameters();
m_cp.ReferencedAssemblies.Add("system.dll");            
m_cp.GenerateExecutable = false;
m_cp.GenerateInMemory = true;
m_cp.CompilerOptions = "/optimize";
...
CompilerResults cr = new CSharpCodeProvider().CompileAssemblyFromSource(m_cp, code.ToString());
if (cr.Errors.HasErrors)
{
   //getting here with error:
   //"Compiling Expression: cannot open c:\Users\*" for reading 
   //'c:\Users\* is not a valid Win32 resource file
   // Example of file c:\Users\[User]\AppData\Local\Temp\1\faw31esr\CSC23CEA88A205E4588B799FD8B4456176B.TMP
}

问题仅发生在某些用户身上,但他们的访问权限是正常的(访问权限与无故障用户相同)。 例如,有问题的用户可以访问显示的目录并删除文件。

其中一种漏洞管理产品阻止了文件访问并导致错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM