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。为什么?