惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

博客园 - Alen在西安

(转)关于教育些微的几个想法 寻找完美的 URL 验证正则表达式 【转发】 解决VS2012 Find and Replace (Ctrl+Shift+F) 不能正常工作的问题 会让你人生失败的31种原因(图 VS2012 DesignTime 笔记 免费用电信的wifi 简单反编译 chm 文件 如何减少silverlight XAP包的尺寸 读书笔记 - .net2.0 异步编程模型: 使用 IAsyncResult 调用异步方法 测试绑定新浪微博 (转)Debug Silverlight in FireFox [转]CLR 全面透彻解析 - 将 APTCA 程序集迁移到 .NET Framework 4 在VS2010 "Choose Toolbox Item" Dialog 中显示自定义控件 笑话一则 Assembly 的 Shadow-Copy 所在的folder Silverlight 控件开发记录之 "extern alias” 关键字 安装完vS2010Beta2后请重置IDE设置 设置保护眼睛的背景色 又到五一了
DTE(vs2012) 编程相关笔记
Alen在西安 · 2012-08-24 · via 博客园 - Alen在西安

仅作记录,方便以后查阅。

1. Reference related:

envdte 

envdte80

envdte90

envdte100 

Microsoft.VisualStudio.Shell.11.0 

...... 

2. Create DTE instance 

// way1 
EnvDTE80.DTE2 _dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0"); 
 // way2
Type visualStudioType = Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
EnvDTE80.DTE2 _dte2 = Activator.CreateInstance(visualStudioType) as EnvDTE80.DTE2; 

3. Get Service from DTE

很多时候,想取shell相关的service,但是用Package.GlobalProvider.GetService(xxx)不行,但是代码在extension和Addin里面可以,所以估计Package的使用范围有限制。

所以必须想办法从DTE去绕。 

IVsUIShell vsUIShell = (new ServiceProvider(DTEInstance as Microsoft.VisualStudio.OLE.Interop.IServiceProvider)).GetService(typeof(SVsShell)) as IVsUIShell;

4. Some com interface not allowed used though they are public seen by refactor 

自己动手重新包一遍,比如

     [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), TypeIdentifier, Guid("0D915B59-2ED7-472A-9DE8-9161737EA1C5")]
    public interface SVsColorThemeService
    {
    }
    [ComImport, TypeIdentifier, Guid("EAB552CF-7858-4F05-8435-62DB6DF60684"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IVsColorThemeService
    {
        void _VtblGap1_4();
        IVsColorThemes Themes { [return: MarshalAs(UnmanagedType.Interface)] get; }
        object ColorNames { [return: MarshalAs(UnmanagedType.Interface)] get; }
        IVsColorTheme CurrentTheme { [return: MarshalAs(UnmanagedType.Interface)] get; }
    }