private string GetComponentPickerDirectories()
{
var enumFactory = site.GetService(typeof (SCompEnumService)) as IVsComponentEnumeratorFactory4;
if (enumFactory == null)
{
throw new InvalidOperationException("Missing the SCompEnumService service.");
}
IEnumComponents enumerator;
Marshal.ThrowExceptionForHR(enumFactory.GetReferencePathsForTargetFramework(
TargetFrameworkMoniker.FullName, out enumerator));
if (enumerator == null)
{
throw new ApplicationException(
"IVsComponentEnumeratorFactory4.GetReferencePathsForTargetFramework returned null.");
}
var paths = new StringBuilder();
var data = new VSCOMPONENTSELECTORDATA[1];
uint fetchedCount;
while (enumerator.Next(1, data, out fetchedCount) == VSConstants.S_OK && fetchedCount == 1)
{
Debug.Assert(data[0].type == VSCOMPONENTTYPE.VSCOMPONENTTYPE_Path);
paths.Append(data[0].bstrFile);
paths.Append(";");
}
// Trim off the last semicolon.
if (paths.Length > 0)
{
paths.Length -= 1;
}
return paths.ToString();
}