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
824 views
in Technique[技术] by (71.8m points)

visual studio 2012 - What happened to regtlibv12?

I have a clean install of Windows 8 on a partition, with Visual Studio 11/2012 Professional installed and I cannot find regtlibv12.exe inside C:WindowsMicrosoft.NETFrameworkv4.0.30319.

Below is a screenshot of my Windows 7 partition, with .Net 4.0 (and regtlibv12):

Windows 7 - .Net 4

Below is Windows 8 with .Net 4.5 (and no regtlibv12):

Windows 8 - .Net 4.5

Is regtlibv12 no longer a part of the .Net framework? Do I need to install .Net 4.0 as well? What would happen if I installed .Net 4.0 over the top of 4.5? I know that they both go to the same location on the hard drive, and 4.5 effectively overwrites 4.0, and 4.5 comes as default on Windows 8. Would I need to install 4.0, and then re-install 4.5 to get regtlibv12 back?

Thanks

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

It was never part of the framework. And it is entirely undocumented. There is however a very consistent rumor that it is, lots of programmers have found it in their v2.0.50727 or v4.0.30319 directories and figured out that it could solve registration problems. Lots of forum posts mention it.

The exact way it shows up in those folders is hard to reverse-engineer, the only pattern I've seen is that it will be there when you install the framework yourself. And won't be there when the framework is pre-installed on the machine. Which somewhat makes sense, there are several .tlb files in the framework directory that need to be registered. They contain type info for .NET [ComVisible] types that client code may have a dependency on. The normal way type libraries get registered does not apply for those .tlb files since they are not embedded in a regular COM server. With the additional guess that the tool isn't needed in a pre-installed version of .NET because the registration info is rolled-up into the regular Windows setup.

If you've gotten yourself into a dependency on the tool then you can't do much beyond copying the .exe from another machine. Or tackle the reason you need to use it from the other end so you don't need it anymore:

  • it is a workaround for forgetting to use the /tlb option with Regasm.exe. That may produce a TYPE_E_CANTLOADLIBRARY error at runtime when client code tries to use a COM interface from another thread. The type library provides the type info that the standard marshaller needs to marshal the arguments of the method. Use the /tlb option to fix that.

  • it is a workaround for getting COM servers to show up in the Project + Add Reference, COM tab. That tab lists registered type libraries. It is however not a proper workaround, other than on build servers, you can compile your code but you can't run it since the registration is not complete. The proper way to do it is by using the author's provided installer or by using Regsvr32.exe in a pinch so both the type library and the CLSID keys get registered.

  • it is a workaround for COM servers that don't register their type library. Similar as above, but registering type libraries is optional and typically only required on your dev machine, not on the machine that runs the server. Most tools that can consume type libraries have a way to add them explicitly rather than depend on the TypeLib registry key. So does the Visual Studio IDE, you can use the Browse tab instead to select the .tlb file directly.


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

...