I'm having to go through a big solution that contains unavailable projects. These unavailable projects are unavailable because their paths don't exist anymore. If this solution were to keep these unavailable references, would there be a way to determine if each project I am looping on is available/unavailable?
Below is a loop whose goal is to determine if every ProjectItem within the current solution is saved. But, since certain projects are unavailable, I keep getting null references.
bool isDirty = false;
foreach (Project proj in sln.Projects) //sln is my current solution
{
if (proj == null) //hoping that might do the trick
continue;
foreach (ProjectItem pi in proj.ProjectItems)
{
if (pi == null) //hoping that might do the trick
continue;
if (!pi.Saved)
{
isDirty = true;
break;
}
}
}