Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IV5的双重定义_C#_Visual Studio_Visual Studio 2012_Com Interop_Visual Studio 2013 - Fatal编程技术网

C# IV5的双重定义

C# IV5的双重定义,c#,visual-studio,visual-studio-2012,com-interop,visual-studio-2013,C#,Visual Studio,Visual Studio 2012,Com Interop,Visual Studio 2013,我试图简单地做到以下几点: this.GetService(typeof(IVsUIShell5)) 但是没有机会获得服务,因为我遇到了以下错误: 嵌入式互操作类型“Microsoft.VisualStudio.Shell.interop.IVsUIShell5”在“Microsoft.VisualStudio.Shell.interop.11.0”和“Microsoft.VisualStudio.ReferenceManager.Providers.dll”中都有定义。调试时不支持对此类型对

我试图简单地做到以下几点:

this.GetService(typeof(IVsUIShell5))
但是没有机会获得服务,因为我遇到了以下错误:

嵌入式互操作类型“Microsoft.VisualStudio.Shell.interop.IVsUIShell5”在“Microsoft.VisualStudio.Shell.interop.11.0”和“Microsoft.VisualStudio.ReferenceManager.Providers.dll”中都有定义。调试时不支持对此类型对象的某些操作。考虑在调试或使用“嵌入互操作类型”属性设置为false时,将此对象转换为“动态”类型。

有什么想法吗?我甚至不能理解这个错误

嵌入互操作类型属性设置为
False

我用这种方法解决了这个问题

using IVsUIShell5 = Microsoft.VisualStudio.Shell.Interop.IVsUIShell5;
......
IVsUIShell5 shell5 = (IVsUIShell5)this.GetService(typeof(IVsUIShell));
我希望有帮助

我就是这样解决的

using IVsUIShell5 = Microsoft.VisualStudio.Shell.Interop.IVsUIShell5;
......
IVsUIShell5 shell5 = (IVsUIShell5)this.GetService(typeof(IVsUIShell));

我希望有帮助

我通过这样的使用解决了这个问题:使用MyIVsUIShell5=Microsoft.VisualStudio.Shell.Interop.IVsUIShell5;不幸的是,现在GetService返回的值为null。为什么?我通过这样的使用解决了这个问题:使用MyIVsUIShell5=Microsoft.VisualStudio.Shell.Interop.IVsUIShell5;不幸的是,现在GetService返回的值为null。为什么?