开发者

Com Error creating Visual Studio 2010 Plugin

I am attempting my first Visual Studio 2010 plugin and am attempting to reference the ActiveSolutionProjects like so

    private DTE2 _applicationObject;

        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
             _applicationObject = (DTE2)application;
             ...
        }

   private void load()
   {         
       var theProjects = (System.Array)_applicationObject.ActiveSolutionProjects;
       ...
   开发者_JS百科 }

The

var theProjects = (System.Array)_applicationObject.ActiveSolutionProjects;

line fails with

Error HRESULT E_FAIL has been returned from a call to a COM component.
ErrorCode -2147467259

Any idea how I fix this error?


The issue is there is no active solution selected and a null reference issue. I just wrapped the call in an exception handler and am investigating how to set the active solution through automation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜