简体   繁体   中英

Visual Studio 2010 Setup Project 64 bit create registry key issue

I have a 64 bit setup project with a 64 bit windows service exe and dlls. In my installer class i create registry keys with this code:

using (typeKey = typeKey.CreateSubKey(@"SOFTWARE\Folder\Folder\Folder"))
        {
            typeKey.SetValue("Type", 0);
            typeKey.Close();
        }

But it keeps creating registry keys at SOFTWARE\\WOW6432NODE\\SOFTWARE\\FOLDER\\FOLDER\\FOLDER. Btw setup copies exe and dlls under 64bit program files folder. No problem in copying folders to 64 bit folder.

Any idea?

This happens because your custom action uses a 32-bit process. Perhaps this article will help: http://blogs.msdn.com/b/heaths/archive/2006/02/01/64-bit-managed-custom-actions-with-visual-studio.aspx

Basically, you need to either make it use a 64-bit process or call a function that can write in the 64-bit registry hive.

您正在使用.NET 4,使用新的RegistryKey.OpenBaseKey()方法并传递RegistryView.Registry64

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM