Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
579 views
in Technique[技术] by (71.8m points)

.net - Use Visual Studio Setup Project to automatically register and GAC a COM Interop DLL

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:

  • Register the assembly (currently using regasm).
    • The assembly needs to be registered successfully and the type library (.tlb) needs to be registered successfully.
    • 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?
    • 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?
  • 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?

Any other advice or concerns would be much appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...