private bool NavigateToViewModel(ViewModelDirectiveValue currentDirective) { //get all declarations of the viewmodel's name var declarations = WorkspaceHelper .GetSyntaxTreeInfos() .SelectMany( s => s.Tree.GetRoot() .DescendantNodes() .OfType <TypeDeclarationSyntax>() .Select(d => new { DeclarationSyntax = d, Info = s })) .Where(s => s.DeclarationSyntax.Identifier.ToString() == currentDirective.TypeName); //get exact match foreach (var declaration in declarations) { //declaration.Info.Compilation.GetTypeByMetadataName() var semanticModel = declaration.Info.Compilation.GetSemanticModel(declaration.DeclarationSyntax.SyntaxTree); var declaredSymbol = semanticModel .GetDeclaredSymbol(declaration.DeclarationSyntax); // check assambly name and namespace if (declaredSymbol.ContainingAssembly.Identity.Name == currentDirective.AssamblyName && declaredSymbol.ContainingNamespace.ToString() == currentDirective.Namespace) { //navigate to definition - open window var item = DTEHelper.GetProjectItemByFullPath(declaration.DeclarationSyntax.Identifier.SyntaxTree.FilePath); DTEHelper.ChangeActiveWindowTo(item); return(true); } } return(false); }