Windows 8.1 Maintenance: What is the ".Net Optimization"

07
2014-07
  • Sarah Weinberger

    Windows 8 and 8.1 (Professional 64-bit in my case) has an automatic maintenance mode that it periodically runs. You can see that periodically when one of the system tray icons changes appearance and has the text maintenance mode running.

    I did some digging and found out that Windows automatic maintenance does two things:

    1. .Net Optimization
    2. Disk defragmentation

    I understand disk defragmenting, but what is ".Net Optimization" and what exactly does Microsoft Windows do to optimize .Net and is that a task that takes a long time?

    I am a software developer and work with .Net technologies, so I understand what the Microsoft .Net Framework is, where Windows stores the assemblies (GAC) and all that. The framework is a bunch of files sitting in the Windows GAC and registry entries. There is no task that would seem to need optimizing and then not any task that would take oodles of time.

  • Answers
  • Oliver Salzburg

    My best guess is that it compiles CIL code to native code so that it doesn't have to do that when you run .Net applications.

    A question on the MSDN forums asks What is the Microsoft .net Optimization service? and one of the answers points out:

    The native image cache contains code that is compiled ahead of time (instead of as the program is being run). When a .NET program is installed, it may instruct this service to compile the native image in the background.

    Even though this question refers to the .Net Optimization service, I would expect that the task you're referring to basically starts this service and lets it run the optimization for all queued items.


  • Related Question

    How to enable .NET Framework 3.5 on Windows 8 without downloading it?
  • Diogo

    Since I installed Windows 8 Preview on my personal computer, during the installation of some programs and drivers (Windows 7 ones) it started to pop me a message warning that .NET Framework 3.5 was needed:

    Enter image description here

    I could use "Install this feature", start to download some dependencies (300 MB) and that's it, but I don't want to have to download it every time I want to enable this feature on every machine that I install Windows 8.

    Is there is some way to install .NET 3.5 on Windows 8 without having to download the entire Framework from Microsoft?


  • Related Answers
  • Peter Mortensen

    Yes, there is an easy way, but you must have installation media for Windows 8 (could be a DVD or even a mounted .ISO with a Windows 8 installation) and make sure the media is for the correct version of Windows (x32 or x64). Otherwise, the command line will fail (not harmful, just annoying):

    • Run a command prompt (cmd) with elevated rights ('as Administrator').
    • Run the following command:

    dism.exe /online /enable-feature /featurename:NetFX3 /All /Source:E:\sources\sxs /LimitAccess

    where "E:\sources\sxs" is the sxs path of your Windows 8 installation media.

    Enter image description here

    • That's it, .NET 3.5 is installed on your machine. Reboot and everything that requires .NET 3.5 will work.