Installing dependencies for an XNA game: Where is the XNA Framework registry path?
How do I make an NSIS installer check if the user has the XNA and .NET framew开发者_如何学Goorks installed, and install them if they aren't? (I'd rather not have it add extra prompt boxes appear, only have a page informing the user that I am making the installation).
EDIT: Due to no answer, I'll just ask this: Where is the XNA Framework in the Registry? Microsoft claims it is at HKEY_LOCAL_MACHINE\Software\Microsoft\XNA\Framework
( http://msdn.microsoft.com/library/bb464156(XNAGameStudio.40).aspx )But I went to that path through regedit (in Windows 7), and it was not there. There was, however, an XNA folder at HKEY_CURRENT_USER\Software\Microsoft\XNA\
But not the /Framework directory.The registry entries you are looking for are:
HKEY_LOCAL_MACHINE\Software\Microsoft\XNA\Framework\v4.0 (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\XNA\Framework\v4.0 (64-bit)
On my Windows 7 Ultimate 64bit machine both those checks return true.
I just finished writing an NSIS install program, here is the script I used for installing the XNA portion:
Section "XNA Framework 4.0" XNA
#check 32bit
ReadRegDWORD $0 HKLM "Software\Microsoft\XNA\Framework\v4.0" "Installed"
#check 64bit
ReadRegDWORD $1 HKLM "Software\Wow6432Node\Microsoft\XNA\Framework\v4.0" "Installed"
DetailPrint "32 bit XNA:"
DetailPrint " $0"
DetailPrint "64 bit XNA:"
DetailPrint " $1"
File "xnafx40_redist.msi"
${If} $0 != 1
${AndIf} $1 != 1
#they do not have framework 4 installed
ExecWait '"msiexec" /i "$INSTDIR\xnafx40_redist.msi" /passive'
${EndIf}
Delete /REBOOTOK "$INSTDIR\xnafx40_redist.msi"
SectionEnd
Are you using Windows 7 64bit? If so you may be looking into wrong registry key. See this: http://en.wikipedia.org/wiki/WoW64#Registry_and_file_system
There is special conversion for keys in 64bit Windows, for example:
HKEY_LOCAL_MACHINE\Software\Wow6432Node
is the 32-bit equivalent of
HKEY_LOCAL_MACHINE\Software
(although 32-bit applications are not aware of this redirection).
In NSIS you should use SetRegView 64
when reading the 64bit/native registry so you don't have to deal with Wow6432Node...
精彩评论