I am creating a web application. In which I like to compile a VS project dynamically using MSBuild.exe. This works great when runs through a local machine. But when I configured in IIS, the same implementation doesn’t work. I suspect the IIS may restrict some permissions. But not clear.
The error I got while compiling is,
CSC : error CS1504: Source file ‘c:\Windows\Temp\Silverlight,Version=v4.0.AssemblyAttributes.cs’ could not be opened (‘Access is denied. ‘)
Note : I am compiling a Silverlight project. Also the above error is the Standard output of Process, which exited with code 1.
The code compiles the project,
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = MSBuildPath;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.RedirectStandardOutput = true;
startInfo.Arguments = "\"" + file.FullName + "\"" + " /t:Rebuild /p:Configuration=Release";
this.process = Process.Start(startInfo);
Any solution for this?
The “Silverlight,Version=v4.0.AssemblyAttributes.cs” files are created in TEMP folder, and since system account (as well as misconfigured user accounts) have TEMP folder in c:\windows\temp, they had to share the same file name. This is a problem, because file created by one account would not have permissions to different account.
Try the following:
1. Create a user account and configure App pool identity to that user account.
2. Set App pool property “Load user profile” to true.
This will ensure your App pool gets its own TEMP directory and does not share state with any other account.