Hi “prog2008”,
In the latest released version of the Silverlight Tools for VS 2008 SP1, the list is persisted in the SilverlightApplicationList property in the referring project file.
For example, I have SilverlightApplication2 and SilverlightApplication2.Web in my solution (the latter references the former). I have the following node in my SilverlightApplication2.Web.csproj file:
<SilverlightApplicationList>{BBA7B148-42AE-477E-BB5E-0BA5AEC0A467}|..\SilverlightApplication2\SilverlightApplication2.csproj|ClientBin|False</SilverlightApplicationList>
There really isn’t a way to access this property via purely DTE, but you can use the Visual Studio SDK / VSIP interfaces to do so (specifically, you want to get the IVsBuildPropertyStorage interface for access to MSBuild properties). Here is a code snippet (runs in a menu command handler in a 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);
}
If you still want to try doing this from an Addin, you’ll have to get follow the approach that Craig mentions to cast the DTE object to an IServiceProvider (so you can call GetService).
-Aaron Marten