Hi TomW,
I try to write a function, which is based on this sample, maybe it can help you:
private void GetProjectReferences(Project project)
{
var vsProject = project.Object as VSLangProj.VSProject;
var references = vsProject.References as VSLangProj.References;
string uniqueName = project.UniqueName;
IVsSolution solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));
IVsHierarchy hierarchy;
solution.GetProjectOfUniqueName(uniqueName, out hierarchy);
IVsBuildPropertyStorage buildPropertyStorage = hierarchy as IVsBuildPropertyStorage;
for (int i= 0; i < references.Count; i++)
{
var reference = references.Item(i);
if (buildPropertyStorage != null && reference.Name == "ClassLibrary1")
{
uint itemId;
string fullPath = reference.Path;
hierarchy.ParseCanonicalName(fullPath, out itemId);
buildPropertyStorage.SetItemAttribute(itemId, "MyAttribute", "MyValue");
break;
}
}
}
Best Regards, Dylan
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our *
*documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**