CompileAssemblyFromSource returns error "Compiling Expression: cannot open c:\Users\*" for reading 'c:\Users\* is not a valid Win32 resource file

  • Thread starter Thread starter Viacheslav Y
  • Start date Start date
V

Viacheslav Y

Guest
Hi Community

My application generates and compiles code runtime:

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
}
Issue is happening only for some users but their access is OK (access is the same as for trouble-free users). E.g. problematic users can get to shown directory and remove files.

Continue reading...
 
Back
Top