/// <summary> /// Create a file node based on an msbuild item. /// </summary> /// <param name="item">The msbuild item to be analyzed</param> public override FileNode CreateFileNode(MsBuildProjectElement item) { Utilities.ArgumentNotNull("item", item); CommonFileNode newNode; if (IsCodeFile(item.GetFullPathForElement())) { newNode = CreateCodeFileNode(item); } else { newNode = CreateNonCodeFileNode(item); } string link = item.GetMetadata(ProjectFileConstants.Link); if (!String.IsNullOrWhiteSpace(link) || !CommonUtils.IsSubpathOf(ProjectHome, item.GetFullPathForElement())) { newNode.SetIsLinkFile(true); } string include = item.GetMetadata(ProjectFileConstants.Include); newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false); newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.ServiceCreator, false); if (!string.IsNullOrEmpty(include) && Path.GetExtension(include).Equals(".xaml", StringComparison.OrdinalIgnoreCase)) { //Create a DesignerContext for the XAML designer for this file newNode.OleServiceProvider.AddService(typeof(DesignerContext), newNode.ServiceCreator, false); } newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false); return newNode; }
public override DependentFileNode CreateDependentFileNode(MsBuildProjectElement item) { DependentFileNode node = base.CreateDependentFileNode(item); if (null != node) { string include = item.GetMetadata(ProjectFileConstants.Include); if (IsCodeFile(include)) { node.OleServiceProvider.AddService( typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false); } } return node; }