title: How to remove previous versions of an offline clickonce application
body: <p>We have an net 4.0 winforms application that we publish with clickonce to the client pc's. The installation is about 80 MB. The application is offline available and the update occurs in the startup of the app using       </p>
  
  <pre><code>ApplicationDeployment.CurrentDeployment.Update
  </code></pre>
  
  <p>Each time we do an update of the application everything works fine and each client gets udpated. However the application cache keeps growing in size...  We noticed that more then two versions are kept in the LocalAppData folder. The size of the clickonce installation folder is more then 1GB.</p>
  
  <p><a href="https://stackoverflow.com/questions/2418542/clear-the-net-downloaded-application-cache-without-mage-exe">ClearOnlineAppCache</a> works only for online applications and we don't find any information to clean the LocalAppData for offline application.  </p>
  
  <p>Is there any way to manage previous versions of our application in the LocalAppData folder from our client pc's?       </p>
  
  <p><strong>Update</strong>:
  We removed our custom update code and used the update mechanism of the Clickonce framework. Now old versions are removed properly and only two versions are kept in LocalAppData. I have still no idea why all versions are kept when we update through the custom update code.</p>