如何为Visual Studio 2008正确获取GetTypeFromProgID [英] how to properly GetTypeFromProgID for visual studio 2008
问题描述
我正在按照这里的说明进行操作:
I am following the instructions here:
http://msdn.microsoft. com/en-us/library/ms228772(v = vs.80).aspx
.net 3.5 visual studio 2008用于解决此问题:
for .net 3.5 visual studio 2008 to fix this issue:
此行代码:
t = System.Type.GetTypeFromProgID("VisualStudio.DTE.8.0",
true);
我收到此错误:
未处理COMException:无效的类字符串(来自的异常 HRESULT:0x800401F3(CO_E_CLASSSTRING))
COMException was unhandled: Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
有人知道这意味着什么吗?我在做什么错了?
Does anyone know what this means, and what am I doing wrong?
非常感谢您的指导.
推荐答案
您的代码与您使用的标记不匹配. VS2008是Visual Studio版本9.0.因此,正确的方法是VisualStudio.DTE.9.0
.版本号的完整列表:
Your code doesn't match the tag you used. VS2008 is Visual Studio version 9.0. So the proper progid is VisualStudio.DTE.9.0
. The full list of version numbers:
- VS2002:7.0
- VS2003:7.1
- VS2005:8.0
- VS2008:9.0
- VS2010:10.0
- VS2012:11.0
- VS2013:12.0
您也可以使用VisualStudio.DTE
程序.您将获得最新安装的VS版本.有点随机.
You can also use the VisualStudio.DTE
progid. You'll get whatever version of VS was installed last. A bit random.
这篇关于如何为Visual Studio 2008正确获取GetTypeFromProgID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!