.net error CS0016: could not write to output file

Posted on 2011-10-21
Last Modified: 2012-05-12
In .net 4 (C#, VS 2010), I'm getting this exception for a Winforms app (not ASP).

Unable to generate a temporary class (result=1).
error CS0016: Could not write to output file 'c:\Users\user\AppData\Local\Temp\vker251c.dll' -- 'Access is denied. '

I've checked the folder in question; EVERYONE has full access rights. Any ideas? Most of what I've seen on the subject concerns ASP and doesn't seem to apply to me.
Question by:BlearyEye
    LVL 14

    Expert Comment

    LVL 1

    Author Comment

    I can try it, but it's also IIS-related and doesn't seem quite relevant to my winform problem.
    LVL 43

    Expert Comment

    >>Could not write to output file 'c:\Users\user\AppData\Local\Temp\vker251c.dll'

    You are attempting to write to a dll - is that correct?  (If yes then is code in the dll in use by your app ?)
    LVL 1

    Author Comment

    Andy: I don't know the answer to that question since the name of the dll doesn't mean anything to me. It seems to be an artifact of the compiler.
    LVL 1

    Accepted Solution

    I switched my TMP and TEMP environment variables to another folder and things started working. I suppose the problem is one of permissions, though I can't see any problem with what they were originally.
    LVL 1

    Author Closing Comment

    My solution worked, though I don't really know why.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now