Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This problem is driving me nuts.

CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework<64>\vX.X.XXXX\Temporary ASP.NET Files\root\XXXXXX\XXXXXX\App_Web_XXXX.aspx.XXXXXXXX.XXXXXXXX.dll' -- 'The directory name is invalid. '

I've tried to give full access to the network service on C:\windows\temp and the temp folder in folder.

The server is Windows Server 2008 R2; SQL Server 2008 R2 is installed on the same server.

I believe that it could have something to do with SQL Server being installed after the .NET Framework 4.0 was installed, but I ran aspnet_regiis.exe -u and then -i to reinstall. I've tried from both the Framework folder and Framework64 folder but to no avail.

Has anyone else had this problem? If so, how did you fix it?

share|improve this question
Does that directory actually exist (the whole path)? Try a complete clean and rebuild. – ChrisF Aug 19 '10 at 9:39
any anti-virus installed that could be interfering? – Jeff Atwood Aug 19 '10 at 11:32

One of the folder names in that path is invalid: Framework<64>. You can't use angle brackets in a folder name, since those symbols are used for redirecting input/output. Does that folder exist? Probably not. So something is trying to create and use that folder and failing with The directory name is invalid. Try looking at the configuration for whatever it is you're running that produces this error. Failing that, try searching the registry for that string and replace it with a more sensible folder name. Your best bet is to first identify which program is trying to use this path, uninstall it completely and reinstall it, making sure that it doesn't try to use an invalid folder name.

share|improve this answer
  1. Create a temporary folder under %Systemroot%, and then name it Temp.
  2. Grant full permissions on the Temp folder to the aspnet user account in .NET Framework 1.0 or to the NETWORK SERVICE user account in .NET Framework 1.1.
  3. Right-click My Computer, and then click Properties.
  4. On the Advanced tab, click Environment Variables.
  5. Select the TEMP variable under System variables, and then click Edit.
  6. Type %SystemRoot%\TEMP in the Variable Value box, and then click OK.
  7. Repeat steps 5 and 6 to edit the TMP variable. Click OK two times.
  8. Click Start, and then click Run.
  9. To reset Internet Information Services (IIS), type iisreset on the command prompt.
share|improve this answer

In the advanced settings of the Application Pool, make sure "Process Model > Load User Profile" is set to "True".

I had this exact same problem. I tried changing permissions, disabling anti-virus, creating a new app pool, and reinstalling .NET 4.0. I even created a new site with just a "Default.aspx" page and tried to view that site. Even that site had the compilation error. Finally, I noticed that my app pools (clean test site and main site) had the non-default value "False" for the Load User Profile setting. I set that back to true and the issue went away.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.