需要知道如何在Windows应用程序中的安装安装时创建注册表项 [英] Need to know how to create registry key at setup installation in Windows application

查看:197
本文介绍了需要知道如何在Windows应用程序中的安装安装时创建注册表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装我的安装文件时,我需要创建注册表项.我该怎么办......
实际上,我使用以下代码创建了安装程序类.

i need to create registry key while installing my setup file. what i have to do....
Actually i created the installer class with the below code.

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;


namespace StockManagement
{
    [RunInstaller(true)]
    public partial class Installer1 : Installer
    {
        public Installer1()
        {
            InitializeComponent();
        }
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);
            int count = 10;
            Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\WIN32");
            key.SetValue("Sys", count, Microsoft.Win32.RegistryValueKind.String);
        }
    }
}




然后我建立它...
然后将其添加到我的安装文件中的
下 自定义操作->安装\

建立我的安装文件后
当我在系统中安装时,它会创建注册表项...
并正常工作.
但是当我在安装过程中在其他系统中安装时..我得到了错误

错误:1001无法在c:\ program files \ stock management.exe程序集中获取安装程序类型.无法加载以下所请求的其他类型之一:检索loader异常属性以获取更多信息..

如何解决此错误...




then i build it...
and i add it in my setup file under
custom actions-->install\

after build my setup file
when i install in my system it creates the registry key...
and works normally..
but when i install in other systems during installation.. i got the error

ERROR:1001 Unable to get the installer types in the c:\program files\stock management.exe assembly.--> Unable to load one are more of the requested types: Retrieve the loader exception property for more information..

how to solve this error...

推荐答案


阅读论坛帖子.
可能是同一问题!
Hi,
Read this forum post.
Maybe its the same issue!


您需要更改安装程序.NET Framework Launch Condition属性,默认情况下为3.5.您必须将其更改回2.0
You need to change the installer .NET Framework Launch Condition property which is by default 3.5 . You have to change it back to 2.0


这篇关于需要知道如何在Windows应用程序中的安装安装时创建注册表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆