Silverlight Tools for VS 2008 SP1 の最新リリース バージョンでは、リストは参照プロジェクト ファイルの SilverlightApplicationList プロパティに保持されます。たとえば、私のソリューションには SilverlightApplication2 と SilverlightApplication2.Web があります (後者は前者を参照しています)。SilverlightApplication2.Web.csproj ファイルに次のノードがあります。
<SilverlightApplicationList>{BBA7B148-42AE-477E-BB5E-0BA5AEC0A467}|..\SilverlightApplication2\SilverlightApplication2.csproj|ClientBin|False</SilverlightApplicationList>
純粋に DTE 経由でこのプロパティにアクセスする方法は実際にはありませんが、Visual Studio SDK / VSIP インターフェイスを使用してアクセスできます (具体的には、MSBuild プロパティにアクセスするために IVsBuildPropertyStorage インターフェイスを取得する必要があります)。コード スニペットを次に示します (VSPackage のメニュー コマンド ハンドラーで実行されます)。
IVsSolution solution = GetService(typeof(SVsSolution)) as IVsSolution;
IVsHierarchy hierarchy;
solution.GetProjectOfUniqueName(@"SilverlightApplication2.Web\SilverlightApplication2.Web.csproj", out hierarchy);
IVsBuildPropertyStorage buildPropertyStorage = hierarchy as IVsBuildPropertyStorage;
if (buildPropertyStorage != null)
{
string silverlightAppListValue;
buildPropertyStorage.GetPropertyValue("SilverlightApplicationList", "Debug", (uint)_PersistStorageType.PST_PROJECT_FILE, out silverlightAppListValue);
MessageBox.Show(silverlightAppListValue);
}
それでもアドインからこれを実行したい場合は、Craig が言及しているアプローチに従って、DTE オブジェクトを IServiceProvider にキャストする必要があります (GetService を呼び出すことができます)。
-アーロン・マーテン