This project has moved and is read-only. For the latest updates, please go here.

Using assembly in MSI installer

Dec 8, 2010 at 1:56 AM

Having a real problem trying to register a Task in an MSI installer with Visual Studio 2010. I can use the assembly just fine in a plain Console application, but in the installer I get an exception which looks like its just unable to initialize COM or something else strange. Anyone know if there are issues loading the assembly within an MSI installer class?

This is the exception that occurs on the first method I run after creating the TaskService and TaskDefinition.

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Win32.TaskScheduler.V2Interop.ITaskDefinition'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{F5BC8FC5-536D-4F77-B852-FBC1356FDEB6}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at Microsoft.Win32.TaskScheduler.V2Interop.ITaskDefinition.get_Triggers()
   at Microsoft.Win32.TaskScheduler.TaskDefinition.get_Triggers()
   at SNMPLoggingService.ProjectInstaller.registerParserTask()

Dec 8, 2010 at 6:07 PM

Half-found a solution. I was making the calls during the commit callbacks of the installer (they happen at the end). Apparently the MSI unloads all the assemblies/dependencies... or something by this point in the installer.

Making the calls during the install callbacks "solves" the issue.