???.net做安装包时获取安装路径写入注册表

时间:2022-09-04 16:10:10
???.net做安装包时获取安装路径写入注册表,可以直接在注册表编辑中去设置么,还是一定要写程序?

3 个解决方案

#1


为什么不在程序运行时进行写入注册表呢
Application.StartupPath

#2


视图-->注册表-->新建字串值   
  设置Value值为[TARGETDIR]


在自定义操作里面,安装后面加入你的安装类,   
  然后在属性中CustomActionData中设置你要的参数   
  /dir=[setupDir]   
    
  然后在你的安装类中.   
    '覆写安装方法   
          Public   Overrides   Sub   Install(ByVal   stateSaver   As   System.Collections.IDictionary)   
                  MyBase.Install(stateSaver)   
                  '取安装程序中用户界面中添回的文本框中的参数值   
                  Dim   setupDir   As   String   =   Me.Context.Parameters.Item("dir")   
    
          End   Sub   


#3


安装类路径  
Assembly   Asm   =   Assembly.GetExecutingAssembly();     
  string   filePath=   Asm.Location;

#1


为什么不在程序运行时进行写入注册表呢
Application.StartupPath

#2


视图-->注册表-->新建字串值   
  设置Value值为[TARGETDIR]


在自定义操作里面,安装后面加入你的安装类,   
  然后在属性中CustomActionData中设置你要的参数   
  /dir=[setupDir]   
    
  然后在你的安装类中.   
    '覆写安装方法   
          Public   Overrides   Sub   Install(ByVal   stateSaver   As   System.Collections.IDictionary)   
                  MyBase.Install(stateSaver)   
                  '取安装程序中用户界面中添回的文本框中的参数值   
                  Dim   setupDir   As   String   =   Me.Context.Parameters.Item("dir")   
    
          End   Sub   


#3


安装类路径  
Assembly   Asm   =   Assembly.GetExecutingAssembly();     
  string   filePath=   Asm.Location;