如何从 Visual Studio 2010 扩展中获取默认项目创建目录?默认情况下,此目录为:
C:\Users\<username>\Documents\Visual Studio 2010\Projects
我猜这是通过“工具”->“选项”窗口完成的,但我不知道如何通过 SDK 来解决这个问题。
乍一看,以下看起来应该让我接近:
DTE2 dte = CType(GetService(typeof(SDTE)), DTE2);
Object props = dte.Properties("Projects and Solutions", "General");
但我收到以下错误:
System.Runtime.InteropServices.COMException was unhandled by user code
ErrorCode=-2147352565
Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))