This is similar to this question, but it doesn't look like a good solution was ever determined, so I'm opening a new one with clarified details.
We wrote a .NET service, which among other things, publishes some of the class hierarchy using WMI. On a 64-Bit machine, we are running the 32-bit version of InstallUtil to install the service. It installs successfully, but when the service runs, we receive the following error message when publishing a WMI class using Instrumentation.Publish()
DirectoryNotFoundException - (Could not find a part of the path
'C:\Windows\system32\WBEM\Framework\root\MyNamespace\MyService'.)
However, this directory does exist in the C:\Windows\syswow64 directory. If we manually copy that directory structure to the system32 directory, then everything works. However, we are looking for automated solution, because we have this packaged up in an MSI which we distribute onto many servers.
We have tried running the 64-Bit version of InstallUtil, to see if that would work, however... and this is the really weird part... it gives us an error on install that says
Installing WMI Schema: Started
An exception occurred during the Install phase.
System.IO.DirectoryNotFoundException:
Could not find a part of the path
'C:\Windows\system32\WBEM\Framework\root\MyNamespace\MyService.mof'.
It looks as if somehow, the WMI installer flipped around. Has anyone else experienced this, or know of a work around?