title: FileNotFoundException during ClickOnce Install, missing HKCU\Software\Classes\Software
body: <p>One of our users has a very serious problem with ClickOnce. The error is a classic one:</p>
  
  <pre><code>     Following errors were detected during this operation.  * [14/10/2011 01:40:25] System.IO.FileNotFoundException
        - The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
        - Source: System.Deployment
        - Stack trace:    
  at System.Deployment.Internal.Isolation.IsolationInterop.GetUserStore(UInt32 Flags, IntPtr hToken, Guid&amp; riid)    
  at System.Deployment.Internal.Isolation.IsolationInterop.GetUserStore()   
  at System.Deployment.Application.ComponentStore..ctor(ComponentStoreType storeType, SubscriptionStore subStore)    
  at System.Deployment.Application.SubscriptionStore..ctor(String deployPath, String tempPath, ComponentStoreType storeType)    
  at System.Deployment.Application.SubscriptionStore.get_CurrentUser()    
  at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String&amp; errorPageUrl)    at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
  </code></pre>
  
  <p>But none of the traditional solutions worked. We tried:</p>
  
  <ol>
  <li>Delete folders and files in manifest related to the application</li>
  <li>Delete 2.0 folder</li>
  <li>Delete App folder</li>
  <li>Run mage -cc</li>
  <li>Kill dfsvc.exe and try again (dfsvc gets loaded everytime it fails)</li>
  </ol>
  
  <p>I published a helloworld app in .NET 3.5 and .NET 4.0 and copied the entire \publish folder to his machine. This also did not install, giving the same error. Finally, I went to the registry to try to add enhanced logging per RobinDotNet and realized that HKCU\Software\Classes\Software was completely missing. Following some more threads, I went and renamed UsrClass.dat. However, after logging off and logging in, this was not rebuilt. I suspect this maybe the issue. Any thoughts on how to get ClickOnce working again?</p>
  
  <p>This is a reasonably fresh Windows 7 Professional install.</p>
  
  <p><strong>Update</strong> Here's another clue. We are able to rename UsrClass.dat to anything or delete it without any complaint from Windows - so it is not being loaded. On my machine it complains that it is under use.</p>