获取 Visual Studio 加载项中解决方案项文件的路径
我正在迭代解决方案及其项目和项目,并且需要检索磁盘上项目的路径。
我可以从 Project.FullName
检索项目文件名,并可以使用 ProjectItem.Properites.Item("FullPath")
获取项目项路径。
但是,对于解决方案“解决方案项目”文件夹中的项目,项目属性成员为空,并且没有我可以看到的其他属性可以帮助我检索该项目的路径。
尽管默认情况下它在添加时将位于与解决方案相同的目录中,但我不能依赖此假设,因为它可以从另一个位置移动或添加为预先存在的项目。
是否有其他方法或我缺少的东西来查找该文件的位置?
I'm iterating through a solution and its projects and items and need to retrieve the path to the items on disk.
I can retrieve the project file name from Project.FullName
and can get a project items path using ProjectItem.Properites.Item("FullPath")
.
However, for an item in the solutions 'Solution Items' folder, the items Properties member is null and has no other properties which I can see could help me retrieve the path to the item.
Although by default it will be located in the same directory as the solution when it is added I can't rely on this assumption as it could be moved or added as a pre-existing item from another location.
Is there another way or something I'm missing to find the location of this file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一下这里,特别是“FileNames”属性: http://msdn .microsoft.com/en-us/library/envdte.projectitem.aspx
Take a look here, particuarly the "FileNames" property: http://msdn.microsoft.com/en-us/library/envdte.projectitem.aspx
试试这个:
我不知道为什么他们不从 0 开始
Try this:
I don't know why they don't start from 0