Visual studio deployment project error when writing to registry
I have a setup for an application that was recently converted to be a framework 4.0 project (don't know if it's relevant). The setup has to write to registry (Local Machine) and until now this has always worked perfectly, however now it fails to write to registry on a clean machine (running Windows 7, 64 bit).
The setup does not fail, does not show a warning of any kind, however it does not write to the registry (I even set AlwaysCreate property to true on every key, ju开发者_运维问答st in case) which of course causes the application to terminate on startup.
What could be the cause of this? I have never encountered such an error before.
Edit: I have tried running the installer as administrator, didn't change anything.
It is writing to the registry okay, just to the wrong key. 32-bit setup programs write to HKLM\Software\Wow6432Node, the set of registry keys that 32-bit programs see. Your app will run in 64-bit mode, it won't get redirected like that.
You'll need to set the target platform in your setup project. Or force your app to run in 32-bit mode with the Target Platform = x86 setting in the Build tab.
Turns out setup project has a property TargetPlatform, that was set to x86. I have changed it to x64 and it works correctly now.
Who would have thought that this would be the only thing affected by the wrong target platform...
精彩评论