/// <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(ProjectElement item) { if (item == null) { throw new ArgumentNullException("item"); } CommonFileNode newNode; if (string.Compare(GetCodeFileExtension(), Path.GetExtension(item.GetFullPathForElement()), StringComparison.OrdinalIgnoreCase) == 0) { newNode = CreateCodeFileNode(item); } else { newNode = CreateNonCodeFileNode(item); } 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); }
/// <summary> /// Create a file node based on an msbuild item. /// </summary> /// <param name="item">msbuild item</param> /// <returns>FileNode added</returns> public override FileNode CreateFileNode(ProjectElement item) { //StaDyn code files (*.stadyn) are wrongly added to project as "Content" project item elements instead of //"Compile". This is a workaround. TODO: Look for registry entry responsible for this behaviour. if (Resources.StaDynFileExt.Equals(Path.GetExtension(item.GetFullPathForElement())) && "Content".Equals(item.ItemName)) { item.ItemName = "Compile"; } return(base.CreateFileNode(item)); }