使用Visual Studio安装项目自动注册和GAC一个COM互操作DLL

时间:2023-01-06 07:35:45

I've created a .NET assembly for COM interop and it is working well on my development machine. I'm currently trying to figure out how to deploy the DLL to a target machine using Visual Studio's "Setup Project." How can I use the VIsual Studio setup project to do the following things:

我为COM interop创建了一个。net程序集,它在我的开发机器上运行良好。我目前正在尝试找出如何使用Visual Studio的“Setup Project”将DLL部署到目标机器上。如何使用VIsual Studio安装项目来完成以下工作:

  • Register the assembly (currently using regasm).
    • The assembly needs to be registered successfully and the type library (.tlb) needs to be registered successfully .
    • 程序集需要成功注册,类型库(.tlb)需要成功注册。
    • This answer suggests scrapping regasm in favor of custom code. I this is a good idea? If so, how does this code get included in the setup project?
    • 这个答案建议放弃regasm而采用自定义代码。我这是个好主意?如果是,该代码如何包含在安装项目中?
    • This answer suggests using the /regfile command of regasm and then using the import tool on the Registry in the Setup Project. Will this work?
    • 这个答案建议使用regasm的/regfile命令,然后在安装项目中使用注册表上的import工具。这工作吗?
  • 注册程序集(当前使用regasm)。程序集需要成功注册,类型库(.tlb)需要成功注册。这个答案建议放弃regasm而采用自定义代码。我这是个好主意?如果是,那么该代码如何被包含在安装项目中?这个答案建议使用regasm的/regfile命令,然后在安装项目中使用注册表上的import工具。这工作吗?
  • Install the assembly in the GAC (currently using gacutil)
    • I'm aware of the "Global Assembly Cache Folder" in the "File System on Target Machine." Is there anything special I need to do in including the assembly in the setup project?
    • 我知道“目标机器上的文件系统”中的“全局程序集缓存文件夹”。在安装项目中包含程序集时,我需要做什么特别的事情吗?
  • 在GAC中安装程序集(目前使用gacutil)我知道“目标计算机上的文件系统”中的“全局程序集缓存文件夹”。在安装项目中包含程序集时,我需要做什么特别的事情吗?

Any other advice or concerns would be much appreciated.

如有任何其他建议或顾虑,我们将不胜感激。

1 个解决方案

#1


33  

Gacutil.exe won't be available on the target machine. Not a problem, MSI can get the job done. Right-click "File System on Target Machine", Add, GAC. Right-click that added folder, Add, Project Output. That ensures the assembly is gac-ed.

Gacutil。exe不能在目标机上使用。没问题,MSI可以完成工作。右键单击“目标机器上的文件系统”,添加,GAC。右键单击添加的文件夹,添加,项目输出。确保程序集是gac-ed。

It can also register the assembly like Regasm.exe does. Set the Register property of the project output reference to vsdrpCOM.

它还可以像Regasm那样注册程序集。exe。将项目输出引用的寄存器属性设置为vsdrpCOM。

#1


33  

Gacutil.exe won't be available on the target machine. Not a problem, MSI can get the job done. Right-click "File System on Target Machine", Add, GAC. Right-click that added folder, Add, Project Output. That ensures the assembly is gac-ed.

Gacutil。exe不能在目标机上使用。没问题,MSI可以完成工作。右键单击“目标机器上的文件系统”,添加,GAC。右键单击添加的文件夹,添加,项目输出。确保程序集是gac-ed。

It can also register the assembly like Regasm.exe does. Set the Register property of the project output reference to vsdrpCOM.

它还可以像Regasm那样注册程序集。exe。将项目输出引用的寄存器属性设置为vsdrpCOM。