Can one cast an EnvDTE.Project into a VCProject

…衆ロ難τιáo~ 提交于 2019-12-08 06:28:18

VCProject is for C++ projects, in order to use a similar interface with C#/VB project you'll have to use VSProject.

There are a number of VSLangProj overloads/extensions and you'll have to find the one that is specific to the version you need to use. See: https://msdn.microsoft.com/en-us/library/1xt0ezx9.aspx for all the VSLangProj interfaces from 2 through 100 (I think thats Version 2 through Version 10).

You can't cast the Project object itself, because there's no inheritance relationship.
But you can use the inner object:

VCProject vcProject = project.Object as VCProject;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!