This problem occurs if the following conditions are true:
- The assembly is copied to the global assembly cache and to a folder.
- The assembly is not copied to a different folder.
However, if you use the Assembly.LoadFrom method to load an assembly in the .NET Framework 2.0, the Location property returns the location of the assembly that is ultimately loaded. When you install the application, the assembly is not yet in the global assembly cache when the custom action runs. Therefore, the assembly is loaded from the folder on the hard disk. This occurs because of the way that the Microsoft Windows Installer file works. Additionally, the Location property returns the path of the folder. The .installstate file is also in the folder.
When you uninstall a .NET Framework 2.0-based application, the assembly is in the global assembly cache. Therefore, the Assembly.LoadFrom method loads the assembly from the global assembly cache. Additionally, the Location property returns a location of the global assembly cache. This location does not contain the .installstate file. Therefore, the .installstate file cannot be found. This causes the problem that is mentioned in the "Symptoms" section.
Method 1Do not use a managed custom action. A custom action may cause this problem. In particular, a managed custom action may cause this problem.
Method 2Follow these steps:
- Put all the custom action code in a different assembly.
- Do not copy the assembly that is mentioned in step 1 to the global assembly cache.
Article ID: 934388 - Last Review: May 5, 2008 - Revision: 1