首页 > 其他 > 详细

ArcGis Classic COM Add-Ins插件.dll的安装与卸载

时间:2019-03-19 23:09:53      阅读:396      评论:0      收藏:0      [点我收藏+]

去年在《ArcGis Classic COM Add-Ins插件开发的一般流程 C#》一文(以下称“开发流程”)中卖了个关子,说后续会有“安装与卸载”系列的文章,今天把它补上。

想起这个事情来缘由是一个小朋友问我怎么卸载插件。

那厮是不是小朋友无法确定,不过从交流方式看挺“小朋友”的,他给我发的第一条信息是“怎么卸载?”

怎么尼妹啊,于是我让他去看上面的文章自己研究去了……

一、安装

1、常用方法Add from file

在ArcMap中【自定义Customize】—【自定义模式Customize mode】—【自文件 Add from file】,添加.tlb文件。

技术分享图片

要清楚.tlb是依赖.dll而存在的,不要删除或者改名.dll。

在“开发流程”中俺写到可以选择是否生成.tlb(Type Library)文件,可以通过在ArcGis的桌面程序中加载.tlb文件实现插件的加载”,也写到“不过这种加载方式有时会存在问题”。

这种方法适合加载一些commands, tools, and toolbars的组件类别,但是对于DockableWindow等的组件类别会有注册问题,也就是说这样安装DockableWindow等的工具是不能用的。

官方帮助里是这样写的:

Use the Customize dialog box in ArcGIS applications to add commands, tools, and toolbars. Click the Add from File button on this dialog box to browse for the type library (.tlb) file created for your customization, then open it, which allows the ArcGIS Framework to add selected classes in the type library to the applicable component category.
This method is beneficial if you want to use an existing compiled component that contains command items (commands, tools, and toolbars) but does not have automatic registration code.
For .NET components, select the type library instead of the .dll file.

 有兴趣扒洋文的,链接在这里:

Registering classes in COM component categories/

2、ESRIRegAsm.exe

自10.0开始ESri改变了以往的把COM组件类别部分注册信息写进注册表的注册方法,采用了自家的ESRIRegAsm.exe对dll进行注册,将部分信息写入注册表,搭配一个xml文档保存注册信息。相关信息可以去翻看“开发流程”。

ESRIRegAsm.exe在~:\Program Files\Common Files\ArcGIS\bin路径下。

在需要安装注册的.dll上右键使用它打开,选择要注册到的对象—注册就可以了,这个“对象”可以是Desktop,也可以是 Engine,它是在.dll的代码里写死的,比如下图的工具只能注册到desktop。

技术分享图片

这种注册方式可以写一个批处理文件搞定,复制放到文本文档,把set "b=%a%YTools.dll"YTools.dll 改成你要注册的.dll名,保存,改扩展名为.bat,双击一下就可以实现注册了。

可以借由这种方式发布插件,实现用户一键注册。

@echo off
echo 》安装插件到ArcMap……………………
set a=%~dp0
echo 》当前路径: %a%
set "b=%a%YTools.dll"
echo 》dll路径:%b%
if "%PROCESSOR_ARCHITECTURE%"=="x86" goto x86
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto x64
:x64
echo 》当前系统位数:64位
cmd  /c"cd/d C:\Program Files (x86)\Common Files\ArcGIS\bin&&ESRIRegAsm.exe /p:desktop "%b%""
exit
:x86
echo 》当前系统位数:32位
cmd  /c"cd/d C:\Program Files\Common Files\ArcGIS\bin&&ESRIRegAsm.exe /p:desktop "%b%""
exit
pause

 

二、卸载

待续~~~~

 

ArcGis Classic COM Add-Ins插件.dll的安装与卸载

原文:https://www.cnblogs.com/yzhyingcool/p/10562110.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!