I'm writing a check-in policy for Team Foundation Server, and would like to know if there's any way to get the path to the project solution's .sln file with the TFS SDK. Seems like there should be a way, just haven't found it yet--any help would be appreciated.
Asked
Active
Viewed 1,254 times
2 Answers
1
Which .sln file? A single Team Project may have more than one.
If you want to get the path to the current solution while Visual Studio is running, then you can use the Visual Studio SDK to do that.

John Saunders
- 160,644
- 26
- 247
- 397
-
I'm looking for the solution file (or solution files, if a lot is being checked in at once) for whatever project is being checked in at the time. – DashRantic Jun 29 '09 at 13:53
-
A project may be included in multiple solution files, or in none. It's not a simple parent/child relationship. – John Saunders Jun 29 '09 at 14:39
0
Found what I needed:
// Enumerate the checked pending changes.
PendingChange[] changes = m_pendingCheckin.PendingChanges.CheckedPendingChanges;
foreach ( PendingChange change in changes )
{
// this contains the full local path to whatever is being checked in
// can use this to find the solution file
change.LocalItem;
}
(m_PendingChecking is of IPendingCheckin type)

DashRantic
- 1,448
- 4
- 19
- 32
-
1Glad that works for you. For others reading this: keep in mind there may be more than one solution file, and not necessarily in the parent folder of the project folder. – John Saunders Jun 29 '09 at 15:00