Search code examples
.netregistryprocessstartinfo

How can I force an ANYCPU .net app to run as 32 or 64 bit?


I have an Office Addin. It launches an app with runas=admin when it needs to set the license key in HKLM. up to Office 2007 Office is 32-bit. However Office 2010 comes in both a 32-bit or 64-bit version. That version determines if an HKLM key is in WoW or note.

Therefore I need to launch the application in the bitness that matches Office (and my AddIn). How can I do that?

Or in the alternative, how can I access both the WoW registry when running in 64-bit mode and the 64-bit (regular) registry when running in WoW?

I am on .NET 3.5.

thanks - dave


Solution

  • You need to have two different exe's compiled respectively. You can't force the bitness of the exe beforehand.