Kazimierz Matyaszek
Kazimierz Matyaszek
1 min read

Tags

I have recently encountered a problem with using VS2013 designer when I develop WPF application. Problem is with a designer cache which is not cleared out. After about three months I have ended up with 0 bytes on my C drive and I was not able to do anything. When I started searching for the possible cause of this situation I found information about the bug in VS2013 connected with the correctly delete cache data from disk. In my case, about 30GB of storage was being used by VS2013 designer cache.

If you have the same problem you can just delete everything from the directory:

%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\Designer\ShadowCache\

But if you don’t want to lose again all space on your hard drive you can create a script and run it via TaskScheduler. Please follow the below steps.

  1. Create a batch script with the following code.
    set cacheLocation="%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\Designer\ShadowCache"
    cd /d %cacheLocation%
    for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
  2. Open TaskScheduler (press the Windows key + R to open the Run box, type taskschd.msc and press Enter).
  3. From Actions menu select Create Basic Task, fill name and description and click Next button.
  4. Next, you can choose when do you want the task to start. In my case, I selected "When I log on".
  5. In the next step, you can select what action will be performed. In this step select "Start a program".
  6. After that select location of your batch script created in step 1 and click Next button.
  7. In the last page, you can see a summary of your action in the previous pages. Click finish if everything is fine.