Hi everybody
In my MPF project on Visual Studio 2012, I've implementing a Reference Manager dialog with IVsReferenceManager::ShowReferenceManager method due the fact that I want to manage my custom project's references
I work with the standard provider FileReferenceProvider that is suitable for me.
The problem is that project references already referenced from my project are not displayed with a checkbox, even though I set IVsProjectReference.AlreadyReference = true after calling CreateReference and AddReference on the context.
The code is the following:
1. ProjectNode::AddProjectReference implement the following (see
var referenceManager =this.GetService(typeof(SVsReferenceManager))asIVsReferenceManager;
if(referenceManager !=null)
{
referenceManager.ShowReferenceManager(
this,
SR.GetString(SR.AddReferenceDialogTitle,CultureInfo.CurrentUICulture),
"VS.ReferenceManager",
VSConstants.FileReferenceProvider_Guid,
true);
returnVSConstants.S_OK;
}
returnVSConstants.E_FAIL;
2. My ProjectNode class implement the interface IVsReferenceManagerUser
3. The Method GetProviderContext() is the following
public Array GetProviderContexts()
{
var referenceManager = this.GetService(typeof(SVsReferenceManager)) as IVsReferenceManager;
var myContext = referenceManager.CreateProviderContext(VSConstants.FileReferenceProvider_Guid) as IVsFileReferenceProviderContext;
myContext.BrowseFilter = "My file (*.txt)|*.txt|All files (*.*)|*.*";
myContext.DefaultBrowseLocation = "my path of txt file";
foreach (CustomReferenceNode node in GetReferenceContainer().EnumReferences().OfType<CustomReferenceNode>())
{
IVsReference reference = myContext.CreateReference() as IVsReference;
reference.Name = node.Caption;
reference.FullPath = node.FullPath;
reference.AlreadyReferenced = true
myContext.AddReference(reference);
}
return new[] { myContext as IVsReferenceProviderContext };
}
Seem that AlreadyReferenced property is not evaluated...
Any thoughts are much appreciated
Thanks in advance.
Nadia