Trinominal
May 14th, 2009, 04:42 PM
Hi,
I'm writing a VS2008 Add-In in C#.
When a solution is opened, I have the Solution object (from the DTE object).
Given a certain path to a file, I'm trying to distinguish whether or not this file belong to the solution or not.
I tried to solve this by iterating all the projects in the solution (by "solution.Project.GetEnumerator()"), and in each project iterate all the project items (by project.ProjectItems.GetEnumerator()"), and I am getting most of the files that belong to the solution, but for some reason, there are files which are not in the project items I'm iterating.
For example, if I have a form class, then the file "Form.cs" is one of the project items, but files like "Form.Designer.cs" and "Form.resx" are not found in the project items collection. Also files under the property directory, e.g. "AssemblyInfo.cs" are not found (only the "Properties" is found as a project item).
Can someone please:
1. Tell me whether is a better way to distinguish whether a certain file belong to a solution or not ?
2. Tell me why the files specified above are not listed in the project items collections ?
Thanks!
I'm writing a VS2008 Add-In in C#.
When a solution is opened, I have the Solution object (from the DTE object).
Given a certain path to a file, I'm trying to distinguish whether or not this file belong to the solution or not.
I tried to solve this by iterating all the projects in the solution (by "solution.Project.GetEnumerator()"), and in each project iterate all the project items (by project.ProjectItems.GetEnumerator()"), and I am getting most of the files that belong to the solution, but for some reason, there are files which are not in the project items I'm iterating.
For example, if I have a form class, then the file "Form.cs" is one of the project items, but files like "Form.Designer.cs" and "Form.resx" are not found in the project items collection. Also files under the property directory, e.g. "AssemblyInfo.cs" are not found (only the "Properties" is found as a project item).
Can someone please:
1. Tell me whether is a better way to distinguish whether a certain file belong to a solution or not ?
2. Tell me why the files specified above are not listed in the project items collections ?
Thanks!