///------------------------------------------------------------------------------------------------------------- /// <summary> /// Returns true if the build action of the item is compile. /// </summary> ///------------------------------------------------------------------------------------------------------------- public bool IsBuildActionCompile() { prjBuildAction buildAction = BuildAction(); if (buildAction == prjBuildAction.prjBuildActionCompile) { return true; } return false; }
internal void SetItemTypeRecursively(prjBuildAction buildAction) { var fileNodesEnumerator = this.EnumNodesOfType <NodejsFileNode>().GetEnumerator(); while (fileNodesEnumerator.MoveNext()) { var includedFileNodeProperties = fileNodesEnumerator.Current.NodeProperties as IncludedFileNodeProperties; if (includedFileNodeProperties != null && includedFileNodeProperties.URL.EndsWith(".js", StringComparison.OrdinalIgnoreCase)) { includedFileNodeProperties.BuildAction = buildAction; } } }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { prjBuildAction buildAction = (prjBuildAction)value; KeyValuePair <string, prjBuildAction> pair = ProjectManager.AvailableFileBuildActions.FirstOrDefault(i => buildAction == i.Value); if (pair.Key != null) { return(pair.Key); } } return(base.ConvertTo(context, culture, value, destinationType)); }
///------------------------------------------------------------------------------------------------------------- /// <summary> /// Gets the build action of the item. /// If not found returns build action none. /// </summary> ///------------------------------------------------------------------------------------------------------------- public prjBuildAction BuildAction() { Properties props = Properties(); if (props != null) { Property propBuildAction = props.Item("BuildAction"); if (propBuildAction != null) { object objValue = propBuildAction.Value; if (objValue != null) { prjBuildAction buildAction = (prjBuildAction)objValue; return buildAction; } } } return prjBuildAction.prjBuildActionNone; }
private bool IsBuildActionCompile(ProjectItem projectItem) { if (projectItem.Properties != null) { // Unfortunately, the code throws if the property doesn't exist... try { var buildActionProperty = projectItem.Properties.Item("BuildAction"); if (buildActionProperty != null) { prjBuildAction buildAction = (prjBuildAction)buildActionProperty.Value; return(buildAction == prjBuildAction.prjBuildActionCompile); } } catch { } } return(false); }
private void AddToProject(string path, prjBuildAction buildAction) { ProjectItem item = null; if (_model.RelateWithActiwFile) item = _projectItem.ProjectItems.AddFromFile(path); else item = _dte.ItemOperations.AddExistingItem(path); item.Properties.Item("BuildAction").Value = (int)buildAction; }
internal void SetItemTypeRecursively(prjBuildAction buildAction) { var fileNodesEnumerator = this.EnumNodesOfType<NodejsFileNode>().GetEnumerator(); while (fileNodesEnumerator.MoveNext()) { var includedFileNodeProperties = fileNodesEnumerator.Current.NodeProperties as IncludedFileNodeProperties; if (includedFileNodeProperties != null && includedFileNodeProperties.URL.EndsWith(".js", StringComparison.OrdinalIgnoreCase)) { includedFileNodeProperties.BuildAction = buildAction; } } }