Sunday, April 17, 2011

Unable to Turn On .NET Framework 3.5.1

If you receive the message, "An error has occurred. Not all of the features were successfully changed." when trying to turn on the .NET Framework 3.5.1 Windows feature in Windows 7, the following may help.

In an adminstrative command prompt, type:


%SystemDrive%
 
cd %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CONFIG
 
copy machine.config.default machine.config
 
copy web.config.default web.config
 
copy web_hightrust.config.default web_hightrust.config
 
copy web_lowtrust.config.default web_lowtrust.config
 
copy web_mediumtrust.config.default web_mediumtrust.config
 
copy web_minimaltrust.config.default web_minimaltrust.config
 

(If you're feeling lazy, run the batch file instead.)

Open the Windows Features control panel applet and try turning on .NET Framework 3.5.1 again.


After perusing "CBS.log" in "%SystemRoot%\Logs\CBS", I discovered that the built-in installer of .NET Framework 3.5.1 expects to find these files properly configured. If it can't, it rolls back the entire installation and prompts you to restart (?!). Luckily, .NET 2.0.50727 comes packed with .default files that are templates for real configuration files. The batch file above just makes copies of these files.

I'm not sure exactly what brought about this conundrum. It may have been the .NET Framework Cleanup Tool, or some other such "helpful" utility. Either way, it's solved now and I can continue to customise the Windows 7 logon screen using the dirty .NET-based tool presumably built by a twelve-year-old that I found.

22 comments:

  1. You are my hero! Your post saved my life and I won't need to format!

    ReplyDelete
  2. Says access is denied on an administrator user account.

    ReplyDelete
  3. Does the caption of your command prompt start with "Administrator:"?

    Try running the steps through Windows explorer instead. Open the CONFIG folder (in all but the most exotic of configurations, this will be "C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG"), make copies of the .default files listed above and remove their .default extension.

    Sorry to hear the command line method didn't work for you. Hope this helps.

    ReplyDelete
  4. If it's a 64-bit system you need to use
    %SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\CONFIG
    ... the directory listed above exists, along with all the expected files, but it probably won't fix your problem.

    ReplyDelete
  5. This worked and has made my night! Thanks!

    ReplyDelete
  6. ran the batch file as admin - same error
    manually enter the commands line by line in cmd-admin mode - same error
    manually renamed and backup the config files in Framework64 - same error
    manually renamed and backup the config files in Framework - same error

    i have window7 64bit and i have removed all other dotnet versions using cleanup tool and restarted.

    ReplyDelete
    Replies
    1. i dont understand what to do what he is telling us tell me my email........sobanali790@gmail.com

      Delete
    2. i dont understand what to do what he is telling us tell me my email........sobanali790@gmail.com

      Delete
  7. Thanks for the solution! As with the other successful posters, it worked for me, and saved me a TON of time, avoiding having to reimage my machine.

    ReplyDelete
  8. thank you!!!!!!!!!!!!!!!!!!!!!!!!! :D

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. can you re-upload the .bat archive please... i'm not too good with commands and i have no lucky doing executing these comands please help me :(

      Delete
  10. Thanks so much....... 2 weeks of nightmare just ended!

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Please Help. I typed Everything you told me to in the command promt. Now i cant even see the .Net Framwork 3.5 options in the turn windows feature on and off menu. Please Help

    ReplyDelete
    Replies
    1. Same happened to me. I believe you have to restart... :-) But in my case... this solution did not help to reinstall framework 3.5 :-(((

      Delete
  13. Also did not work for me with Windows 7 SP1 64-Bit. Tried above solution from Framework64 folder, which also did not work.

    ReplyDelete
  14. Also did not work for me with Windows 7 SP1 64-Bit. Tried above solution from Framework64 folder, which also did not work.

    ReplyDelete
  15. Did it both ways usind command prompt and bat file, still same error. I have 32Bit W7 professional. Some help maybe?

    ReplyDelete
  16. Didn't work.

    What DID work for me was a third party .net 3.5 OFFLINE installer.

    ReplyDelete