制作自己写的arcgis desktop工具栏的安装程序

参考文献:http://support.esri.com/index.cfm?fa=knowledgebase.techArticles.articleShow&d=24868

  1. 新建一个Installer类,取名为"InstallerConfig.cs";
  2. 右键单击它,选择"查看代码"这一项,添加以下代码:
  3.         {

                try

                {

                    base.Install(stateSaver);

                    RegistrationServices regSrv = new RegistrationServices();

                    if (!regSrv.RegisterAssembly(base.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))

                        throw new InstallException("注册COM组件失败!");

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message, "安装过程发生了错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                }

            }

            public override void Uninstall(IDictionary savedState)

            {

                try

                {

                    base.Uninstall(savedState);

                    RegistrationServices regSrv = new RegistrationServices();

                    if (!regSrv.UnregisterAssembly(base.GetType().Assembly))

                        throw new InstallException("取消注册COM组件失败!");

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message, "卸载过程发生了错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                }

            }

  4. 添加一个"安装项目",在其它项目类型-->安装与部署,并设置项目的属性。
  5. 右击安装项目,选择添加-->项目输出,接着选择你的DLL项目
  6. "依赖项"中排除以ESRI开头的所有dll文件,和stdole.dll
  7. 选择"自定义操作"视图,右键单击左边的视图中的"安装"选项,添加新的自定义操作。
  8. 双击"应用程序文件夹",选择"主输出来自<AssemblyName>"
  9. "卸载"选项做同样的操作。
  10. 参考文献:http://support.esri.com/index.cfm?fa=knowledgebase.techArticles.articleShow&d=24868

    (先存个英文的)

  11. 新建一个Installer类,取名为"InstallerConfig.cs";
  12. 右键单击它,选择"查看代码"这一项,添加以下代码:
  13.         {

                try

                {

                    base.Install(stateSaver);

                    RegistrationServices regSrv = new RegistrationServices();

                    if (!regSrv.RegisterAssembly(base.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))

                        throw new InstallException("注册COM组件失败!");

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message, "安装过程发生了错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                }

            }

            public override void Uninstall(IDictionary savedState)

            {

                try

                {

                    base.Uninstall(savedState);

                    RegistrationServices regSrv = new RegistrationServices();

                    if (!regSrv.UnregisterAssembly(base.GetType().Assembly))

                        throw new InstallException("取消注册COM组件失败!");

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message, "卸载过程发生了错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                }

            }

  14. 添加一个"安装项目",在其它项目类型-->安装与部署,并设置项目的属性。
  15. 右击安装项目,选择添加-->项目输出,接着选择你的DLL项目
  16. "依赖项"中排除以ESRI开头的所有dll文件,和stdole.dll
  17. 选择"自定义操作"视图,右键单击左边的视图中的"安装"选项,添加新的自定义操作。
  18. 双击"应用程序文件夹",选择"主输出来自<AssemblyName>"
  19. "卸载"选项做同样的操作。
  20. 生成工程,即可。
posted @ 2010-04-13 08:55  iLocationStudio  阅读(340)  评论(0)    收藏  举报