├── .gitignore ├── .vs └── MSBuildProjectBrowser │ └── v15 │ └── sqlite3 │ └── storage.ide ├── LICENSE ├── MSBuildProjectBrowser.sln ├── MSBuildProjectBrowser ├── Configuration │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── MSBuildItemTreeViewNodeSorter.cs ├── MSBuildProjectBrowser.csproj ├── MSBuildProjectBrowser.csproj.user ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── MsBuildProjectHelper.cs ├── Program.cs ├── Resources │ └── open_project_vs_24.bmp └── app.config └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | **/*.suo 2 | **/bin/ 3 | **/obj/ 4 | **/.vs/ 5 | -------------------------------------------------------------------------------- /.vs/MSBuildProjectBrowser/v15/sqlite3/storage.ide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsdn/MSBuildProjectBrowser/70667c964137f8b5205c29ef7d030f5486cc7365/.vs/MSBuildProjectBrowser/v15/sqlite3/storage.ide -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Russian Software Developer Network 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildProjectBrowser", "MSBuildProjectBrowser\MSBuildProjectBrowser.csproj", "{357BA3C5-89D7-4024-BA35-44A1D64C2FCA}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {357BA3C5-89D7-4024-BA35-44A1D64C2FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {357BA3C5-89D7-4024-BA35-44A1D64C2FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {357BA3C5-89D7-4024-BA35-44A1D64C2FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {357BA3C5-89D7-4024-BA35-44A1D64C2FCA}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Configuration/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MSBuildProjectBrowser")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("optim.ru")] 12 | [assembly: AssemblyProduct("MSBuildProjectBrowser")] 13 | [assembly: AssemblyCopyright("Copyright @ optim.ru 2005")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | /// Setting ComVisible to false makes the types in this assembly not visible 18 | /// to COM componenets. If you need to access a type in this assembly from 19 | /// COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Configuration/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MSBuildProjectBrowser.Configuration { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MSBuildProjectBrowser.Configuration.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap open_project_vs_24 { 67 | get { 68 | object obj = ResourceManager.GetObject("open_project_vs_24", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Configuration/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | 119 | ..\Resources\open_project_vs_24.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 120 | 121 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Configuration/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MSBuildProjectBrowser.Configuration { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Configuration/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MSBuildItemTreeViewNodeSorter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Collections; 5 | using System.Windows.Forms; 6 | 7 | namespace MSBuildProjectBrowser 8 | { 9 | class MSBuildTreeViewNodeSorter : IComparer, IComparer 10 | { 11 | #region IComparer Members 12 | 13 | public int Compare(object x, object y) 14 | { 15 | return Compare((TreeNode)x, (TreeNode)y); 16 | } 17 | 18 | #endregion 19 | 20 | #region IComparer Members 21 | 22 | public int Compare(TreeNode x, TreeNode y) 23 | { 24 | if (x.Tag != null && y.Tag == null) 25 | return 1; 26 | 27 | if (x.Tag == null && y.Tag != null) 28 | return -1; 29 | 30 | return x.Text.CompareTo(y.Text); 31 | } 32 | 33 | public bool Equals(TreeNode x, TreeNode y) 34 | { 35 | return Compare(x, y) == 0; 36 | } 37 | 38 | public int GetHashCode(TreeNode obj) 39 | { 40 | return obj.Text.GetHashCode(); 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MSBuildProjectBrowser.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.41115 7 | 2.0 8 | {357BA3C5-89D7-4024-BA35-44A1D64C2FCA} 9 | WinExe 10 | MSBuildProjectBrowser 11 | MSBuildProjectBrowser 12 | 4 13 | v4.5.1 14 | 15 | 16 | 17 | 18 | 2.0 19 | publish\ 20 | true 21 | Disk 22 | false 23 | Foreground 24 | 7 25 | Days 26 | false 27 | false 28 | true 29 | 0 30 | 1.0.0.%2a 31 | false 32 | false 33 | true 34 | 35 | 36 | 37 | true 38 | full 39 | false 40 | .\bin\Debug\ 41 | DEBUG;TRACE 42 | false 43 | 44 | 45 | pdbonly 46 | true 47 | .\bin\Release\ 48 | TRACE 49 | false 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | True 66 | True 67 | Resources.resx 68 | 69 | 70 | True 71 | True 72 | Settings.settings 73 | 74 | 75 | Form 76 | 77 | 78 | MainForm.cs 79 | 80 | 81 | 82 | 83 | 84 | 85 | ResXFileCodeGenerator 86 | Resources.Designer.cs 87 | 88 | 89 | MainForm.cs 90 | 91 | 92 | 93 | SettingsSingleFileGenerator 94 | Settings.Designer.cs 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | False 103 | .NET Framework 3.5 SP1 Client Profile 104 | false 105 | 106 | 107 | False 108 | .NET Framework 3.5 SP1 109 | true 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MSBuildProjectBrowser.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 8.0.41115 5 | ProjectFiles 6 | 0 7 | 8 | 9 | 10 | 11 | 12 | 13 | en-US 14 | false 15 | 16 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MSBuildProjectBrowser 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); 33 | this._projectTreeView = new System.Windows.Forms.TreeView(); 34 | this.imageList1 = new System.Windows.Forms.ImageList(this.components); 35 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 36 | this._leftTabControl = new System.Windows.Forms.TabControl(); 37 | this._itemsTabPage = new System.Windows.Forms.TabPage(); 38 | this._propertiesTabPage = new System.Windows.Forms.TabPage(); 39 | this._propertiesListView = new System.Windows.Forms.ListView(); 40 | this._nameColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 41 | this._valueColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 42 | this._finalValueColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 43 | this.panel1 = new System.Windows.Forms.Panel(); 44 | this._expansionResultTextBox = new System.Windows.Forms.TextBox(); 45 | this._stringToExpandTextBox = new System.Windows.Forms.TextBox(); 46 | this._clearAllButton = new System.Windows.Forms.Button(); 47 | this._clearPropertyNamePrefixFilterTextButton = new System.Windows.Forms.Button(); 48 | this._clearValueContentFilterButton = new System.Windows.Forms.Button(); 49 | this._valueContentFilterTextBox = new System.Windows.Forms.TextBox(); 50 | this._propertyNamePrefixFilterTextBox = new System.Windows.Forms.TextBox(); 51 | this._rightTabControl = new System.Windows.Forms.TabControl(); 52 | this._propertyTabPage = new System.Windows.Forms.TabPage(); 53 | this._propertyGrid = new System.Windows.Forms.PropertyGrid(); 54 | this.tabPage2 = new System.Windows.Forms.TabPage(); 55 | this._mainMenuStrip = new System.Windows.Forms.MenuStrip(); 56 | this._fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 57 | this._openProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 | this._openProjectDialog = new System.Windows.Forms.OpenFileDialog(); 59 | this._toolStripContainer = new System.Windows.Forms.ToolStripContainer(); 60 | this._mainToolStrip = new System.Windows.Forms.ToolStrip(); 61 | this._openProjectToolStripButton = new System.Windows.Forms.ToolStripButton(); 62 | this._projectConfigurationToolStripComboBox = new System.Windows.Forms.ToolStripComboBox(); 63 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 64 | this.splitContainer1.Panel1.SuspendLayout(); 65 | this.splitContainer1.Panel2.SuspendLayout(); 66 | this.splitContainer1.SuspendLayout(); 67 | this._leftTabControl.SuspendLayout(); 68 | this._itemsTabPage.SuspendLayout(); 69 | this._propertiesTabPage.SuspendLayout(); 70 | this.panel1.SuspendLayout(); 71 | this._rightTabControl.SuspendLayout(); 72 | this._propertyTabPage.SuspendLayout(); 73 | this._mainMenuStrip.SuspendLayout(); 74 | this._toolStripContainer.ContentPanel.SuspendLayout(); 75 | this._toolStripContainer.TopToolStripPanel.SuspendLayout(); 76 | this._toolStripContainer.SuspendLayout(); 77 | this._mainToolStrip.SuspendLayout(); 78 | this.SuspendLayout(); 79 | // 80 | // _projectTreeView 81 | // 82 | this._projectTreeView.Dock = System.Windows.Forms.DockStyle.Fill; 83 | this._projectTreeView.HideSelection = false; 84 | this._projectTreeView.ImageIndex = 0; 85 | this._projectTreeView.ImageList = this.imageList1; 86 | this._projectTreeView.LabelEdit = true; 87 | this._projectTreeView.Location = new System.Drawing.Point(3, 3); 88 | this._projectTreeView.Name = "_projectTreeView"; 89 | this._projectTreeView.SelectedImageIndex = 0; 90 | this._projectTreeView.Size = new System.Drawing.Size(913, 497); 91 | this._projectTreeView.TabIndex = 0; 92 | this._projectTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this._projectTreeView_AfterSelect); 93 | // 94 | // imageList1 95 | // 96 | this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); 97 | this.imageList1.TransparentColor = System.Drawing.Color.Transparent; 98 | this.imageList1.Images.SetKeyName(0, "folder_vs_24.bmp"); 99 | this.imageList1.Images.SetKeyName(1, "class_vs_24.bmp"); 100 | this.imageList1.Images.SetKeyName(2, "property_vs_24.bmp"); 101 | this.imageList1.Images.SetKeyName(3, "open_project_vs_24.bmp"); 102 | // 103 | // splitContainer1 104 | // 105 | this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 106 | this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; 107 | this.splitContainer1.Location = new System.Drawing.Point(0, 0); 108 | this.splitContainer1.Name = "splitContainer1"; 109 | // 110 | // splitContainer1.Panel1 111 | // 112 | this.splitContainer1.Panel1.Controls.Add(this._leftTabControl); 113 | this.splitContainer1.Panel1.Controls.Add(this.panel1); 114 | // 115 | // splitContainer1.Panel2 116 | // 117 | this.splitContainer1.Panel2.Controls.Add(this._rightTabControl); 118 | this.splitContainer1.Size = new System.Drawing.Size(1358, 611); 119 | this.splitContainer1.SplitterDistance = 927; 120 | this.splitContainer1.TabIndex = 1; 121 | this.splitContainer1.Text = "splitContainer1"; 122 | // 123 | // _leftTabControl 124 | // 125 | this._leftTabControl.Controls.Add(this._itemsTabPage); 126 | this._leftTabControl.Controls.Add(this._propertiesTabPage); 127 | this._leftTabControl.Dock = System.Windows.Forms.DockStyle.Fill; 128 | this._leftTabControl.Location = new System.Drawing.Point(0, 82); 129 | this._leftTabControl.Name = "_leftTabControl"; 130 | this._leftTabControl.SelectedIndex = 0; 131 | this._leftTabControl.Size = new System.Drawing.Size(927, 529); 132 | this._leftTabControl.TabIndex = 1; 133 | // 134 | // _itemsTabPage 135 | // 136 | this._itemsTabPage.Controls.Add(this._projectTreeView); 137 | this._itemsTabPage.Location = new System.Drawing.Point(4, 22); 138 | this._itemsTabPage.Name = "_itemsTabPage"; 139 | this._itemsTabPage.Padding = new System.Windows.Forms.Padding(3); 140 | this._itemsTabPage.Size = new System.Drawing.Size(919, 503); 141 | this._itemsTabPage.TabIndex = 0; 142 | this._itemsTabPage.Text = "Items"; 143 | // 144 | // _propertiesTabPage 145 | // 146 | this._propertiesTabPage.Controls.Add(this._propertiesListView); 147 | this._propertiesTabPage.Location = new System.Drawing.Point(4, 22); 148 | this._propertiesTabPage.Name = "_propertiesTabPage"; 149 | this._propertiesTabPage.Padding = new System.Windows.Forms.Padding(3); 150 | this._propertiesTabPage.Size = new System.Drawing.Size(919, 503); 151 | this._propertiesTabPage.TabIndex = 1; 152 | this._propertiesTabPage.Text = "Properties"; 153 | // 154 | // _propertiesListView 155 | // 156 | this._propertiesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 157 | this._nameColumnHeader, 158 | this._valueColumnHeader, 159 | this._finalValueColumnHeader}); 160 | this._propertiesListView.Dock = System.Windows.Forms.DockStyle.Fill; 161 | this._propertiesListView.FullRowSelect = true; 162 | this._propertiesListView.HideSelection = false; 163 | this._propertiesListView.LargeImageList = this.imageList1; 164 | this._propertiesListView.Location = new System.Drawing.Point(3, 3); 165 | this._propertiesListView.Name = "_propertiesListView"; 166 | this._propertiesListView.ShowItemToolTips = true; 167 | this._propertiesListView.Size = new System.Drawing.Size(913, 497); 168 | this._propertiesListView.SmallImageList = this.imageList1; 169 | this._propertiesListView.Sorting = System.Windows.Forms.SortOrder.Ascending; 170 | this._propertiesListView.TabIndex = 0; 171 | this._propertiesListView.UseCompatibleStateImageBehavior = false; 172 | this._propertiesListView.View = System.Windows.Forms.View.Details; 173 | this._propertiesListView.SelectedIndexChanged += new System.EventHandler(this._propertiesListView_SelectedIndexChanged); 174 | // 175 | // _nameColumnHeader 176 | // 177 | this._nameColumnHeader.Text = "Name"; 178 | this._nameColumnHeader.Width = 374; 179 | // 180 | // _valueColumnHeader 181 | // 182 | this._valueColumnHeader.Text = "UnevaluatedValue"; 183 | this._valueColumnHeader.Width = 182; 184 | // 185 | // _finalValueColumnHeader 186 | // 187 | this._finalValueColumnHeader.Text = "EvaluatedValue"; 188 | this._finalValueColumnHeader.Width = 319; 189 | // 190 | // panel1 191 | // 192 | this.panel1.Controls.Add(this._expansionResultTextBox); 193 | this.panel1.Controls.Add(this._stringToExpandTextBox); 194 | this.panel1.Controls.Add(this._clearAllButton); 195 | this.panel1.Controls.Add(this._clearPropertyNamePrefixFilterTextButton); 196 | this.panel1.Controls.Add(this._clearValueContentFilterButton); 197 | this.panel1.Controls.Add(this._valueContentFilterTextBox); 198 | this.panel1.Controls.Add(this._propertyNamePrefixFilterTextBox); 199 | this.panel1.Dock = System.Windows.Forms.DockStyle.Top; 200 | this.panel1.Location = new System.Drawing.Point(0, 0); 201 | this.panel1.Name = "panel1"; 202 | this.panel1.Size = new System.Drawing.Size(927, 82); 203 | this.panel1.TabIndex = 2; 204 | // 205 | // _expansionResultTextBox 206 | // 207 | this._expansionResultTextBox.Location = new System.Drawing.Point(340, 44); 208 | this._expansionResultTextBox.Name = "_expansionResultTextBox"; 209 | this._expansionResultTextBox.ReadOnly = true; 210 | this._expansionResultTextBox.Size = new System.Drawing.Size(580, 20); 211 | this._expansionResultTextBox.TabIndex = 6; 212 | // 213 | // _stringToExpandTextBox 214 | // 215 | this._stringToExpandTextBox.Location = new System.Drawing.Point(50, 44); 216 | this._stringToExpandTextBox.Name = "_stringToExpandTextBox"; 217 | this._stringToExpandTextBox.Size = new System.Drawing.Size(284, 20); 218 | this._stringToExpandTextBox.TabIndex = 5; 219 | this._stringToExpandTextBox.TextChanged += new System.EventHandler(this._stringToExpandTextBox_TextChanged); 220 | // 221 | // _clearAllButton 222 | // 223 | this._clearAllButton.Location = new System.Drawing.Point(837, 0); 224 | this._clearAllButton.Name = "_clearAllButton"; 225 | this._clearAllButton.Size = new System.Drawing.Size(83, 23); 226 | this._clearAllButton.TabIndex = 4; 227 | this._clearAllButton.Text = "Clear all"; 228 | this._clearAllButton.UseVisualStyleBackColor = true; 229 | this._clearAllButton.Click += new System.EventHandler(this._clearAllButton_Click); 230 | // 231 | // _clearPropertyNamePrefixFilterTextButton 232 | // 233 | this._clearPropertyNamePrefixFilterTextButton.Location = new System.Drawing.Point(340, 0); 234 | this._clearPropertyNamePrefixFilterTextButton.Name = "_clearPropertyNamePrefixFilterTextButton"; 235 | this._clearPropertyNamePrefixFilterTextButton.Size = new System.Drawing.Size(55, 23); 236 | this._clearPropertyNamePrefixFilterTextButton.TabIndex = 3; 237 | this._clearPropertyNamePrefixFilterTextButton.Text = "Clear"; 238 | this._clearPropertyNamePrefixFilterTextButton.UseVisualStyleBackColor = true; 239 | this._clearPropertyNamePrefixFilterTextButton.Click += new System.EventHandler(this._clearPropertyNamePrefixFilterTextButton_Click); 240 | // 241 | // _clearValueContentFilterButton 242 | // 243 | this._clearValueContentFilterButton.Location = new System.Drawing.Point(767, 0); 244 | this._clearValueContentFilterButton.Name = "_clearValueContentFilterButton"; 245 | this._clearValueContentFilterButton.Size = new System.Drawing.Size(55, 23); 246 | this._clearValueContentFilterButton.TabIndex = 2; 247 | this._clearValueContentFilterButton.Text = "Clear"; 248 | this._clearValueContentFilterButton.UseVisualStyleBackColor = true; 249 | this._clearValueContentFilterButton.Click += new System.EventHandler(this._clearValueContentFilterButton_Click); 250 | // 251 | // _valueContentFilterTextBox 252 | // 253 | this._valueContentFilterTextBox.Location = new System.Drawing.Point(401, 3); 254 | this._valueContentFilterTextBox.Name = "_valueContentFilterTextBox"; 255 | this._valueContentFilterTextBox.Size = new System.Drawing.Size(360, 20); 256 | this._valueContentFilterTextBox.TabIndex = 1; 257 | this._valueContentFilterTextBox.TextChanged += new System.EventHandler(this._valueContentFilterTextBox_TextChanged); 258 | // 259 | // _propertyNamePrefixFilterTextBox 260 | // 261 | this._propertyNamePrefixFilterTextBox.Location = new System.Drawing.Point(50, 3); 262 | this._propertyNamePrefixFilterTextBox.Name = "_propertyNamePrefixFilterTextBox"; 263 | this._propertyNamePrefixFilterTextBox.Size = new System.Drawing.Size(284, 20); 264 | this._propertyNamePrefixFilterTextBox.TabIndex = 0; 265 | this._propertyNamePrefixFilterTextBox.TextChanged += new System.EventHandler(this._filterTextBox_TextChanged); 266 | // 267 | // _rightTabControl 268 | // 269 | this._rightTabControl.Controls.Add(this._propertyTabPage); 270 | this._rightTabControl.Controls.Add(this.tabPage2); 271 | this._rightTabControl.Dock = System.Windows.Forms.DockStyle.Fill; 272 | this._rightTabControl.Location = new System.Drawing.Point(0, 0); 273 | this._rightTabControl.Name = "_rightTabControl"; 274 | this._rightTabControl.SelectedIndex = 0; 275 | this._rightTabControl.Size = new System.Drawing.Size(427, 611); 276 | this._rightTabControl.TabIndex = 0; 277 | // 278 | // _propertyTabPage 279 | // 280 | this._propertyTabPage.Controls.Add(this._propertyGrid); 281 | this._propertyTabPage.Location = new System.Drawing.Point(4, 22); 282 | this._propertyTabPage.Name = "_propertyTabPage"; 283 | this._propertyTabPage.Padding = new System.Windows.Forms.Padding(3); 284 | this._propertyTabPage.Size = new System.Drawing.Size(419, 585); 285 | this._propertyTabPage.TabIndex = 0; 286 | this._propertyTabPage.Text = "Property"; 287 | // 288 | // _propertyGrid 289 | // 290 | this._propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; 291 | this._propertyGrid.LineColor = System.Drawing.SystemColors.ControlDark; 292 | this._propertyGrid.Location = new System.Drawing.Point(3, 3); 293 | this._propertyGrid.Name = "_propertyGrid"; 294 | this._propertyGrid.Size = new System.Drawing.Size(413, 579); 295 | this._propertyGrid.TabIndex = 1; 296 | // 297 | // tabPage2 298 | // 299 | this.tabPage2.Location = new System.Drawing.Point(4, 22); 300 | this.tabPage2.Name = "tabPage2"; 301 | this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 302 | this.tabPage2.Size = new System.Drawing.Size(419, 585); 303 | this.tabPage2.TabIndex = 1; 304 | this.tabPage2.Text = "..."; 305 | // 306 | // _mainMenuStrip 307 | // 308 | this._mainMenuStrip.Dock = System.Windows.Forms.DockStyle.None; 309 | this._mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 310 | this._fileToolStripMenuItem}); 311 | this._mainMenuStrip.Location = new System.Drawing.Point(0, 0); 312 | this._mainMenuStrip.Name = "_mainMenuStrip"; 313 | this._mainMenuStrip.Size = new System.Drawing.Size(1358, 24); 314 | this._mainMenuStrip.TabIndex = 1; 315 | this._mainMenuStrip.Text = "menuStrip1"; 316 | // 317 | // _fileToolStripMenuItem 318 | // 319 | this._fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 320 | this._openProjectToolStripMenuItem}); 321 | this._fileToolStripMenuItem.Name = "_fileToolStripMenuItem"; 322 | this._fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); 323 | this._fileToolStripMenuItem.Text = "&File"; 324 | // 325 | // _openProjectToolStripMenuItem 326 | // 327 | this._openProjectToolStripMenuItem.Image = global::MSBuildProjectBrowser.Configuration.Resources.open_project_vs_24; 328 | this._openProjectToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; 329 | this._openProjectToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.White; 330 | this._openProjectToolStripMenuItem.Name = "_openProjectToolStripMenuItem"; 331 | this._openProjectToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 332 | this._openProjectToolStripMenuItem.Text = "&Open project..."; 333 | this._openProjectToolStripMenuItem.Click += new System.EventHandler(this._openProjectToolStripMenuItem_Click); 334 | // 335 | // _openProjectDialog 336 | // 337 | this._openProjectDialog.DefaultExt = "*.proj"; 338 | this._openProjectDialog.Filter = "Project files|*.*proj"; 339 | this._openProjectDialog.Title = "Open project"; 340 | // 341 | // _toolStripContainer 342 | // 343 | // 344 | // _toolStripContainer.ContentPanel 345 | // 346 | this._toolStripContainer.ContentPanel.Controls.Add(this.splitContainer1); 347 | this._toolStripContainer.ContentPanel.Size = new System.Drawing.Size(1358, 611); 348 | this._toolStripContainer.Dock = System.Windows.Forms.DockStyle.Fill; 349 | this._toolStripContainer.Location = new System.Drawing.Point(0, 0); 350 | this._toolStripContainer.Name = "_toolStripContainer"; 351 | this._toolStripContainer.Size = new System.Drawing.Size(1358, 660); 352 | this._toolStripContainer.TabIndex = 2; 353 | this._toolStripContainer.Text = "toolStripContainer1"; 354 | // 355 | // _toolStripContainer.TopToolStripPanel 356 | // 357 | this._toolStripContainer.TopToolStripPanel.Controls.Add(this._mainMenuStrip); 358 | this._toolStripContainer.TopToolStripPanel.Controls.Add(this._mainToolStrip); 359 | // 360 | // _mainToolStrip 361 | // 362 | this._mainToolStrip.AllowItemReorder = true; 363 | this._mainToolStrip.Dock = System.Windows.Forms.DockStyle.None; 364 | this._mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 365 | this._openProjectToolStripButton, 366 | this._projectConfigurationToolStripComboBox}); 367 | this._mainToolStrip.Location = new System.Drawing.Point(3, 24); 368 | this._mainToolStrip.Name = "_mainToolStrip"; 369 | this._mainToolStrip.Size = new System.Drawing.Size(252, 25); 370 | this._mainToolStrip.TabIndex = 0; 371 | this._mainToolStrip.Text = "toolStrip1"; 372 | // 373 | // _openProjectToolStripButton 374 | // 375 | this._openProjectToolStripButton.Image = global::MSBuildProjectBrowser.Configuration.Resources.open_project_vs_24; 376 | this._openProjectToolStripButton.ImageTransparentColor = System.Drawing.Color.White; 377 | this._openProjectToolStripButton.Name = "_openProjectToolStripButton"; 378 | this._openProjectToolStripButton.Size = new System.Drawing.Size(105, 22); 379 | this._openProjectToolStripButton.Text = "Open project..."; 380 | this._openProjectToolStripButton.Click += new System.EventHandler(this._openProjectToolStripButton_Click); 381 | // 382 | // _projectConfigurationToolStripComboBox 383 | // 384 | this._projectConfigurationToolStripComboBox.Name = "_projectConfigurationToolStripComboBox"; 385 | this._projectConfigurationToolStripComboBox.Size = new System.Drawing.Size(100, 25); 386 | this._projectConfigurationToolStripComboBox.ToolTipText = "Project Configuration"; 387 | this._projectConfigurationToolStripComboBox.SelectedIndexChanged += new System.EventHandler(this._projectConfigurationToolStripComboBox_SelectedIndexChanged); 388 | // 389 | // MainForm 390 | // 391 | this.ClientSize = new System.Drawing.Size(1358, 660); 392 | this.Controls.Add(this._toolStripContainer); 393 | this.Name = "MainForm"; 394 | this.Text = "MSBuild Profect Viewer"; 395 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); 396 | this.splitContainer1.Panel1.ResumeLayout(false); 397 | this.splitContainer1.Panel2.ResumeLayout(false); 398 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 399 | this.splitContainer1.ResumeLayout(false); 400 | this._leftTabControl.ResumeLayout(false); 401 | this._itemsTabPage.ResumeLayout(false); 402 | this._propertiesTabPage.ResumeLayout(false); 403 | this.panel1.ResumeLayout(false); 404 | this.panel1.PerformLayout(); 405 | this._rightTabControl.ResumeLayout(false); 406 | this._propertyTabPage.ResumeLayout(false); 407 | this._mainMenuStrip.ResumeLayout(false); 408 | this._mainMenuStrip.PerformLayout(); 409 | this._toolStripContainer.ContentPanel.ResumeLayout(false); 410 | this._toolStripContainer.TopToolStripPanel.ResumeLayout(false); 411 | this._toolStripContainer.TopToolStripPanel.PerformLayout(); 412 | this._toolStripContainer.ResumeLayout(false); 413 | this._toolStripContainer.PerformLayout(); 414 | this._mainToolStrip.ResumeLayout(false); 415 | this._mainToolStrip.PerformLayout(); 416 | this.ResumeLayout(false); 417 | 418 | } 419 | 420 | #endregion 421 | 422 | private System.Windows.Forms.TreeView _projectTreeView; 423 | private System.Windows.Forms.SplitContainer splitContainer1; 424 | private System.Windows.Forms.MenuStrip _mainMenuStrip; 425 | private System.Windows.Forms.ToolStripMenuItem _fileToolStripMenuItem; 426 | private System.Windows.Forms.ToolStripMenuItem _openProjectToolStripMenuItem; 427 | private System.Windows.Forms.OpenFileDialog _openProjectDialog; 428 | private System.Windows.Forms.TabControl _rightTabControl; 429 | private System.Windows.Forms.TabPage _propertyTabPage; 430 | private System.Windows.Forms.TabPage tabPage2; 431 | private System.Windows.Forms.PropertyGrid _propertyGrid; 432 | private System.Windows.Forms.TabControl _leftTabControl; 433 | private System.Windows.Forms.TabPage _itemsTabPage; 434 | private System.Windows.Forms.TabPage _propertiesTabPage; 435 | private System.Windows.Forms.ImageList imageList1; 436 | private System.Windows.Forms.ListView _propertiesListView; 437 | private System.Windows.Forms.ColumnHeader _nameColumnHeader; 438 | private System.Windows.Forms.ColumnHeader _valueColumnHeader; 439 | private System.Windows.Forms.ColumnHeader _finalValueColumnHeader; 440 | private System.Windows.Forms.ToolStripContainer _toolStripContainer; 441 | private System.Windows.Forms.ToolStrip _mainToolStrip; 442 | private System.Windows.Forms.ToolStripButton _openProjectToolStripButton; 443 | private System.Windows.Forms.ToolStripComboBox _projectConfigurationToolStripComboBox; 444 | private System.Windows.Forms.Panel panel1; 445 | private System.Windows.Forms.TextBox _propertyNamePrefixFilterTextBox; 446 | private System.Windows.Forms.TextBox _valueContentFilterTextBox; 447 | private System.Windows.Forms.Button _clearValueContentFilterButton; 448 | private System.Windows.Forms.Button _clearPropertyNamePrefixFilterTextButton; 449 | private System.Windows.Forms.Button _clearAllButton; 450 | private System.Windows.Forms.TextBox _expansionResultTextBox; 451 | private System.Windows.Forms.TextBox _stringToExpandTextBox; 452 | } 453 | } 454 | 455 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.IO; 8 | using System.Windows.Forms; 9 | using System.Linq; 10 | 11 | using RSharp.Compiler; 12 | //using Microsoft.Build.BuildEngine; 13 | using Microsoft.Build; 14 | using Microsoft.Build.Evaluation; 15 | using System.Web; 16 | 17 | namespace MSBuildProjectBrowser 18 | { 19 | using StrTreeNodePair = KeyValuePair>; 20 | using ItemTypesMap = Dictionary>; 21 | using TreeMap = Dictionary; 22 | 23 | partial class MainForm : Form 24 | { 25 | const string ConfigPropName = "Configuration"; 26 | 27 | 28 | public MainForm() 29 | { 30 | InitializeComponent(); 31 | } 32 | 33 | #region Рабочие поля. 34 | 35 | MsBuildProjectHelper _msBuildHelper; 36 | 37 | /// 38 | /// Путь к последнему загруженному проекту. 39 | /// 40 | private string _lastOpenedProject; 41 | 42 | /// 43 | /// Флаг загрузки информации о конфигурации. 44 | /// 45 | private bool _isConfigurationLoading; 46 | 47 | #endregion 48 | 49 | #region Загрузка проекта. 50 | 51 | /// 52 | /// Считываес (с помощью API MSBuild) содержимое файла проекта 53 | /// и заполняет GUI-элементы соотвествующими значениями. 54 | /// 55 | /// 56 | /// Имя конфигурации которую нужно считать. Если пустая строка или null 57 | /// 58 | private void OpenProject(string prjPath, string configuration) 59 | { 60 | if (string.IsNullOrEmpty(prjPath) || !File.Exists(prjPath)) 61 | { 62 | MessageBox.Show(this, "Error", 63 | "Wrong project path '" + prjPath + "'"); 64 | return; 65 | } 66 | 67 | _propertyGrid.SelectedObject = null; 68 | 69 | MsBuildProjectHelper msBuildHelper = new MsBuildProjectHelper(prjPath); 70 | 71 | _msBuildHelper = msBuildHelper; 72 | 73 | // Если configuration не пуста устанавливаем значение свойства 74 | // Configuration. Это позволит считать соотвествующую конфигурацию 75 | // проекта. 76 | if (!string.IsNullOrEmpty(configuration)) 77 | msBuildHelper.Project.SetProperty(ConfigPropName, configuration); 78 | 79 | this.Text = "MSBuild Profect Viewer - " + Path.GetFullPath(prjPath); 80 | 81 | FillItemsView(msBuildHelper); 82 | FillPropertiesView(msBuildHelper); 83 | FillConfiguration(msBuildHelper); 84 | 85 | _lastOpenedProject = prjPath; 86 | } 87 | 88 | /// 89 | /// Выводит диалог открытия прокта и считываес 90 | /// (с помощью API MSBuild) содержимое файла проекта 91 | /// и заполняет GUI-элементы соотвествующими значениями. 92 | /// 93 | private void OpenProject() 94 | { 95 | if (_openProjectDialog.ShowDialog(this) == DialogResult.OK) 96 | OpenProject(_openProjectDialog.FileName, ""); 97 | } 98 | 99 | #endregion 100 | 101 | #region Обработчики событий GUI. 102 | 103 | private void _projectConfigurationToolStripComboBox_SelectedIndexChanged( 104 | object sender, 105 | EventArgs e) 106 | { 107 | if (_isConfigurationLoading 108 | || _projectConfigurationToolStripComboBox.SelectedItem == null) 109 | return; 110 | 111 | if (string.IsNullOrEmpty(_lastOpenedProject)) 112 | MessageBox.Show(this, "Error", "Open a project first!"); 113 | else 114 | OpenProject( 115 | _lastOpenedProject, 116 | _projectConfigurationToolStripComboBox.SelectedItem.ToString()); 117 | } 118 | 119 | private void _openProjectToolStripMenuItem_Click( 120 | object sender, 121 | EventArgs e) 122 | { 123 | OpenProject(); 124 | } 125 | 126 | private void _openProjectToolStripButton_Click(object sender, EventArgs e) 127 | { 128 | OpenProject(); 129 | } 130 | 131 | private void _projectTreeView_AfterSelect( 132 | object sender, 133 | TreeViewEventArgs e) 134 | { 135 | // При выделении ветки в дереве элементов проекта отображаем 136 | // выбранный элемент в PropertyGrid. 137 | if (e.Node != null) 138 | _propertyGrid.SelectedObject = e.Node.Tag; 139 | } 140 | 141 | private void _propertiesListView_SelectedIndexChanged( 142 | object sender, 143 | EventArgs e) 144 | { 145 | // При выделении строки в списке свойств проекта отображаем 146 | // выбранное свойство в PropertyGrid. 147 | if (_propertiesListView.FocusedItem != null) 148 | _propertyGrid.SelectedObject = _propertiesListView.FocusedItem.Tag; 149 | } 150 | 151 | private void MainForm_FormClosed(object sender, FormClosedEventArgs e) 152 | { 153 | // Этот код замазывает баг фрэймворка. Если процесс не убивать, 154 | // то при выходе происходит ужасная загрузка процессора и процесс 155 | // замерзает на довольно продолжительное время. 156 | System.Diagnostics.Process.GetCurrentProcess().Kill(); 157 | } 158 | 159 | #endregion 160 | 161 | #region Загрузка списка конфигуркций. 162 | 163 | /// 164 | /// Считывет список конфигураций и заполняет ими выпадающий список 165 | /// в панеле инструментов. 166 | /// 167 | /// 168 | private void FillConfiguration(MsBuildProjectHelper msBuildHelper) 169 | { 170 | try 171 | { 172 | _isConfigurationLoading = true; 173 | 174 | Project prj = msBuildHelper.Project; 175 | 176 | var sonfigurations = prj.ConditionedProperties.Count == 0 ? null : prj.ConditionedProperties[ConfigPropName]; 177 | 178 | _projectConfigurationToolStripComboBox.Items.Clear(); 179 | if (sonfigurations != null) 180 | _projectConfigurationToolStripComboBox.Items.AddRange(sonfigurations.ToArray()); 181 | 182 | 183 | var property = msBuildHelper.Project.GetProperty(ConfigPropName); 184 | 185 | 186 | if (property != null) 187 | _projectConfigurationToolStripComboBox.Text = property.EvaluatedValue; 188 | } 189 | finally 190 | { 191 | _isConfigurationLoading = false; 192 | } 193 | } 194 | 195 | #endregion 196 | 197 | #region Заполнение списка свойств. 198 | 199 | private static HashSet _commonMSBuildProperties = new HashSet 200 | { 201 | "AdditionalLibPaths", 202 | "AddModules", 203 | "ALToolPath", 204 | "ApplicationIcon", 205 | "ApplicationManifest", 206 | "AssemblyOriginatorKeyFile", 207 | "AssemblySearchPaths", 208 | "AssemblyName", 209 | "BaseAddress", 210 | "BaseOutputPath", 211 | "BaseIntermediateOutputPath", 212 | "BuildInParallel", 213 | "BuildProjectReferences", 214 | "CleanFile", 215 | "CodePage", 216 | "CompilerResponseFile", 217 | "Configuration", 218 | "CscToolPath", 219 | "CustomBeforeMicrosoftCommonTargets", 220 | "DebugSymbols", 221 | "DefineConstants", 222 | "DefineDebug", 223 | "DefineTrace", 224 | "DebugType", 225 | "DelaySign", 226 | "DisabledWarnings", 227 | "DisableFastUpToDateCheck", 228 | "DocumentationFile", 229 | "ErrorReport", 230 | "ExcludeDeploymentUrl", 231 | "FileAlignment", 232 | "FrameworkPathOverride", 233 | "GenerateDocumentation", 234 | "IntermediateOutputPath", 235 | "KeyContainerName", 236 | "KeyOriginatorFile", 237 | "NoWin32Manifest", 238 | "ModuleAssemblyName", 239 | "NoLogo", 240 | "NoStdLib", 241 | "NoVBRuntimeReference", 242 | "NoWin32Manifest", 243 | "Optimize", 244 | "OptionCompare", 245 | "OptionExplicit", 246 | "OptionInfer", 247 | "OptionStrict", 248 | "OutputPath", 249 | "OutputType", 250 | "OverwriteReadOnlyFiles", 251 | "PdbFile", 252 | "Platform", 253 | "RemoveIntegerChecks", 254 | "SGenUseProxyTypes", 255 | "SGenToolPath", 256 | "StartupObject", 257 | "ProcessorArchitecture", 258 | "RootNamespace", 259 | "Satellite_AlgorithmId", 260 | "Satellite_BaseAddress", 261 | "Satellite_CompanyName", 262 | "Satellite_Configuration", 263 | "Satellite_Description", 264 | "Satellite_EvidenceFile", 265 | "Satellite_FileVersion", 266 | "Satellite_Flags", 267 | "Satellite_GenerateFullPaths", 268 | "Satellite_LinkResource", 269 | "Satellite_MainEntryPoint", 270 | "Satellite_ProductName", 271 | "Satellite_ProductVersion", 272 | "Satellite_TargetType", 273 | "Satellite_Title", 274 | "Satellite_Trademark", 275 | "Satellite_Version", 276 | "Satellite_Win32Icon", 277 | "Satellite_Win32Resource", 278 | "SubsystemVersion", 279 | "TargetCompactFramework", 280 | "TargetFrameworkVersion", 281 | "TreatWarningsAsErrors", 282 | "UseHostCompilerIfAvailable", 283 | "Utf8Output", 284 | "VbcToolPath", 285 | "VbcVerbosity", 286 | "VisualStudioVersion", 287 | "WarningsAsErrors", 288 | "WarningsNotAsErrors", 289 | "Win32Manifest", 290 | "Win32Resource" 291 | }; 292 | 293 | 294 | /// 295 | /// Считывает описание свойств MSBuild и заполняет ими ListView. 296 | /// 297 | /// MsBuildProjectHelper 298 | /// 299 | private void FillPropertiesView(MsBuildProjectHelper msBuildHelper) 300 | { 301 | var propPrefixFilter = _propertyNamePrefixFilterTextBox.Text; 302 | var hasPropPrefixFilter = propPrefixFilter.Length > 0; 303 | var propPrefixFilterOptions = propPrefixFilter.All(char.IsLower) ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; 304 | 305 | var valueContentFilter = _valueContentFilterTextBox.Text; 306 | var hasValueContentFilter = valueContentFilter.Length > 0; 307 | 308 | _propertiesListView.BeginUpdate(); 309 | 310 | try 311 | { 312 | _propertiesListView.Items.Clear(); 313 | 314 | // EvaluatedProperties содержит список свойств получаемый 315 | // после всех подстановок и проверок. 316 | foreach (ProjectProperty prop in msBuildHelper.Project.AllEvaluatedProperties) 317 | { 318 | var evaluatedValue = prop.EvaluatedValue ?? ""; 319 | var unevaluatedValue = prop.UnevaluatedValue ?? ""; 320 | 321 | if (hasPropPrefixFilter && !prop.Name.StartsWith(propPrefixFilter, propPrefixFilterOptions)) 322 | continue; 323 | 324 | if (hasValueContentFilter && !(evaluatedValue.Contains(valueContentFilter) || unevaluatedValue.Contains(valueContentFilter))) 325 | continue; 326 | 327 | var envVarValue = Environment.GetEnvironmentVariable(prop.Name); 328 | 329 | ListViewItem lvItem = new ListViewItem(prop.Name); 330 | lvItem.SubItems.Add(prop.UnevaluatedValue); 331 | 332 | if (evaluatedValue == envVarValue) 333 | lvItem.ForeColor = Color.DarkGray; 334 | else if (_commonMSBuildProperties.Contains(prop.Name)) 335 | lvItem.ForeColor = Color.Blue; 336 | 337 | lvItem.SubItems.Add(evaluatedValue); 338 | 339 | lvItem.Tag = prop; 340 | lvItem.ImageIndex = 2; 341 | _propertiesListView.Items.Add(lvItem); 342 | } 343 | 344 | } 345 | finally 346 | { 347 | _propertiesListView.EndUpdate(); 348 | } 349 | } 350 | 351 | #endregion 352 | 353 | #region Заполнение делева элементов 354 | 355 | /// 356 | /// Считывает описание элеметов MSBuild и заполняет ими TreeView. 357 | /// 358 | /// MsBuildProjectHelper 359 | private void FillItemsView(MsBuildProjectHelper msBuildHelper) 360 | { 361 | _projectTreeView.BeginUpdate(); 362 | try 363 | { 364 | // Первый проходом считываем элементы группируя их по типам. 365 | // itemTypesMap содержит ассоциативный массив имен типов элементов 366 | // и списков элементов. 367 | ItemTypesMap itemTypesMap = InitItemTypesMap(msBuildHelper); 368 | 369 | // Сортировка в TreeView делается очень медленно. По этому запрещаем 370 | // ее и выполняем ее потом вручную. 371 | _projectTreeView.TreeViewNodeSorter = null; 372 | _projectTreeView.Sorted = false; 373 | // Очищаем TreeView. 374 | _projectTreeView.Nodes.Clear(); 375 | 376 | // Эта переменная будет содержать список корневых веток TreeView. 377 | TreeNodeCollection rootNodes = _projectTreeView.Nodes; 378 | 379 | // Для каждого типа элементов... 380 | foreach (StrTreeNodePair elem in itemTypesMap) 381 | { 382 | // ... создаем корневую TreeView-ветку... 383 | TreeNode typeNode = new TreeNode(elem.Key); 384 | rootNodes.Add(typeNode); 385 | 386 | // Эта переменная будет содержать мап путь/TreeView-веток 387 | // для этого пути. 388 | TreeMap treeMap = new TreeMap(); 389 | 390 | // Для каждого элемента данного типа... 391 | foreach (TreeNode node in elem.Value) 392 | { 393 | // ... получаем путь к фалу. 394 | string dir = Path.GetDirectoryName(node.Text); 395 | // Находим соотвествующий фолдер (TreeView-ветку его описывающую). 396 | TreeNode folder = GetParentFolder(typeNode, treeMap, dir); 397 | // Получаем имя файла... 398 | string file = Path.GetFileName(node.Text); 399 | // ... которое используем в качестве имени элемента. 400 | node.Text = file; 401 | // Назначаем иконки файлов и добавляем ветку. 402 | const int FileImageIndex = 1; 403 | node.ImageIndex = FileImageIndex; 404 | node.SelectedImageIndex = FileImageIndex; 405 | folder.Nodes.Add(node); 406 | } 407 | } 408 | 409 | // Закат солнца вручную. :) Ручная сортировка требуется в виду 410 | // диких тормозов встроенной в TreeView сортировки. 411 | // Возможно к релизу эту проблему стронят, но пока... 412 | SortTreeNodes(rootNodes, new MSBuildTreeViewNodeSorter()); 413 | } 414 | finally 415 | { 416 | // Что бы не случилось нужно разрешить отрисовку. Иначе любой глюк 417 | // приведет к непотребному виду TreeView. 418 | _projectTreeView.EndUpdate(); 419 | } 420 | } 421 | 422 | #endregion 423 | 424 | #region Utilits 425 | 426 | /// 427 | /// Считывает список MSBuild-элементов и группирует их п типам 428 | /// (помещая в мап (имя типа/список элеметов этого типа)). 429 | /// 430 | /// MsBuildProjectHelper 431 | /// мап (имя типа/список элеметов этого типа) 432 | private static ItemTypesMap InitItemTypesMap(MsBuildProjectHelper msBuildHelper) 433 | { 434 | ItemTypesMap itemTypesMap = new ItemTypesMap(); 435 | 436 | foreach (ProjectItem item in msBuildHelper.GetProjectItems()) 437 | { 438 | string itemType = item.ItemType; 439 | List items = GetItemsByType(itemTypesMap, itemType); 440 | 441 | string nodeName = item.GetMetadataValue("Link"); 442 | 443 | // Если у элемента нет атрибута "Link", то используем для 444 | // имени ветки путь к элементу. 445 | if (string.IsNullOrEmpty(nodeName)) 446 | nodeName = item.EvaluatedInclude; 447 | 448 | TreeNode node = new TreeNode(nodeName); 449 | node.Tag = item; 450 | 451 | items.Add(node); 452 | 453 | if (items.Count == 1) 454 | itemTypesMap[itemType] = items; 455 | } 456 | return itemTypesMap; 457 | } 458 | 459 | /// 460 | /// Возвращает список элементов для заданного типа. 461 | /// Если список отсуствует создает новый список. 462 | /// 463 | /// 464 | /// Мап (имя типа/список элеметов этого типа) 465 | /// 466 | /// Тип требуемых элементов 467 | /// Список элементов заданного типа 468 | private static List GetItemsByType( 469 | ItemTypesMap itemTypesMap, 470 | string itemType) 471 | { 472 | List items; 473 | if (itemTypesMap.ContainsKey(itemType)) 474 | items = itemTypesMap[itemType]; 475 | else 476 | items = new List(); 477 | return items; 478 | } 479 | 480 | /// 481 | /// Возвращает родительскую TreeView-ветку для заданного пути. 482 | /// Фолдер или берется из кэша, или создается (и добавляется в кэш). 483 | /// 484 | /// Ветка типа (корневая ветка иерархии) 485 | /// Кэш (мап путей/веток) 486 | /// Путь для которого нужно найти ветку 487 | /// 488 | private static TreeNode GetParentFolder( 489 | TreeNode typeNode, 490 | TreeMap treeMap, 491 | string dir) 492 | { 493 | TreeNode folder; 494 | if (treeMap.ContainsKey(dir)) 495 | folder = treeMap[dir]; 496 | else 497 | { 498 | if (dir.Length == 0) 499 | folder = typeNode; 500 | else 501 | { 502 | string[] dirs = dir.Split('\\', '/'); 503 | if (dirs.Length == 0) 504 | folder = typeNode; 505 | else 506 | folder = GetFolderNode(typeNode, treeMap, 507 | dirs, dirs.Length); 508 | } 509 | } 510 | return folder; 511 | } 512 | 513 | private static TreeNode GetFolderNode( 514 | TreeNode parent, 515 | TreeMap treeMap, 516 | string[] dirs, 517 | int dirCount) 518 | { 519 | StringBuilder sb = new StringBuilder(); 520 | for (int i = 0; i < dirCount; i++) 521 | { 522 | sb.Append(dirs[i]); 523 | sb.Append('\\'); 524 | } 525 | 526 | string currDirName = sb.ToString(); 527 | 528 | if (treeMap.ContainsKey(currDirName)) 529 | return treeMap[currDirName]; 530 | else 531 | { 532 | if (dirCount == 0) 533 | return parent; 534 | else 535 | { 536 | TreeNode ret = GetFolderNode( 537 | parent, 538 | treeMap, 539 | dirs, 540 | dirCount - 1); 541 | 542 | TreeNode newNode = new TreeNode(dirs[dirCount - 1]); 543 | treeMap.Add(currDirName, newNode); 544 | ret.Nodes.Add(newNode); 545 | return newNode; 546 | } 547 | } 548 | } 549 | 550 | /// 551 | /// Рекурсивная сортировка веток TreeView. 552 | /// 553 | /// Коллекция веток подлежащая сортировке 554 | private static void SortTreeNodes( 555 | TreeNodeCollection rootNodes, 556 | IComparer comparer) 557 | { 558 | int count = rootNodes.Count; 559 | if (count == 0) 560 | return; 561 | 562 | // Копируем содержимое коллекции подветок в массив, 563 | // сортируем этот массв, очищаем коллекцию и копируем 564 | // подвекти обратно в коллекцию. 565 | TreeNode[] nodeArray = new TreeNode[count]; 566 | rootNodes.CopyTo(nodeArray, 0); 567 | Array.Sort(nodeArray, comparer); 568 | rootNodes.Clear(); 569 | rootNodes.AddRange(nodeArray); 570 | 571 | // Сортируем все подветки 572 | foreach (TreeNode node in nodeArray) 573 | SortTreeNodes(node.Nodes, comparer); 574 | } 575 | 576 | 577 | /// 578 | /// Чтение свойств MSBuild. 579 | /// 580 | /// MsBuildProjectHelper 581 | /// Имя свойства 582 | /// 583 | private static string GetMSBuildPropertyValue(MsBuildProjectHelper msbuild, string propertyName) 584 | { 585 | ProjectProperty prop = msbuild.Project.GetProperty(propertyName); 586 | if (prop == null) 587 | return ""; 588 | 589 | return prop.UnevaluatedValue; 590 | } 591 | 592 | #endregion 593 | 594 | private void _filterTextBox_TextChanged(object sender, EventArgs e) 595 | { 596 | if (_msBuildHelper == null) 597 | return; 598 | 599 | FillItemsView(_msBuildHelper); 600 | FillPropertiesView(_msBuildHelper); 601 | } 602 | 603 | private void _valueContentFilterTextBox_TextChanged(object sender, EventArgs e) 604 | { 605 | if (_msBuildHelper == null) 606 | return; 607 | 608 | FillItemsView(_msBuildHelper); 609 | FillPropertiesView(_msBuildHelper); 610 | } 611 | 612 | private void _clearValueContentFilterButton_Click(object sender, EventArgs e) 613 | { 614 | _valueContentFilterTextBox.Text = ""; 615 | } 616 | 617 | private void _clearPropertyNamePrefixFilterTextButton_Click(object sender, EventArgs e) 618 | { 619 | _propertyNamePrefixFilterTextBox.Text = ""; 620 | } 621 | 622 | private void _clearAllButton_Click(object sender, EventArgs e) 623 | { 624 | _valueContentFilterTextBox.Text = ""; 625 | _propertyNamePrefixFilterTextBox.Text = ""; 626 | } 627 | 628 | private void _stringToExpandTextBox_TextChanged(object sender, EventArgs e) 629 | { 630 | if (_msBuildHelper == null) 631 | return; 632 | 633 | var result = HttpUtility.HtmlDecode(_msBuildHelper.Project.ExpandString(_stringToExpandTextBox.Text)); 634 | _expansionResultTextBox.Text = result; 635 | } 636 | } 637 | } 638 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MainForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 125 | AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w 126 | LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 127 | ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABQ 128 | DwAAAk1TRnQBSQFMAgEBBAEAAVwBAAFcAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA 129 | AwABIAMAAQEBAAEYBgABGP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AB4Alv8BlwGAAW8BjwF4AWYBgQFo 130 | AVUBeQFgAU0BcwFZAUYBbQFTAT9m/wH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eAGqAZUBhwG+AbcBsA//AUIBTQE+BwABPgMAASgDAAFA 193 | AwABIAMAAQEBAAEBBgABARYAA///AAIACw== 194 | 195 | 196 | 197 | 127, 17 198 | 199 | 200 | 267, 17 201 | 202 | 203 | 425, 17 204 | 205 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/MsBuildProjectHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | //using Microsoft.Build.BuildEngine; 5 | using Microsoft.Build; 6 | using Microsoft.Build.Evaluation; 7 | using System.IO; 8 | using System.Reflection; 9 | 10 | namespace RSharp.Compiler 11 | { 12 | /// 13 | /// Класс предназначен для урпощения работы с MSBuild (утилитой сборки 14 | /// проектов). 15 | /// 16 | /// 17 | /// Для загрузки проекта воспользуйтесь специальным конструктором или 18 | /// методом LoadProjectFromFile. 19 | /// 20 | /// Далее можно воспользоваться свойством Project (для доступа к 21 | /// свойствам и содержимому проекта) или получить список файлов 22 | /// входящих в проект с помощью метода GetProjectFiles. 23 | /// Чтобы получить нужный список файлов и правильные значения 24 | /// свойств нужно сначала задать значения глобальных свойств проекта 25 | /// это можно сделать с помощью метода Project.SetProperty. 26 | /// Узнать список и значения доступных глобальных свойств можно 27 | /// с помощью Project.GlobalProperties (перебором или по имени свойства). 28 | /// 29 | /// Например, чтобы задать Release-конфигурацию нужно 30 | /// выполнить следующий код: 31 | /// 32 | /// MsBuildProjectHelper msbuild = new MsBuildProjectHelper(prjPath); 33 | /// msbuild.Project.SetProperty("Configuration", "Release", ""); 34 | /// 35 | /// 36 | /// Чтобы узнать значения свойств зависящих от конфигурации можно 37 | /// воспользоваться свойством Project.EvaluatedProperties: 38 | /// 39 | /// string defineConstants = 40 | /// msbuild.Project.EvaluatedProperties["DefineConstants"].Value; 41 | /// 42 | /// 43 | public class MsBuildProjectHelper 44 | { 45 | /// 46 | /// Путь к проекту или Solution MSBuild. 47 | /// 48 | public MsBuildProjectHelper(string prjPath) 49 | { 50 | LoadProjectFromFile(prjPath); 51 | } 52 | 53 | /// 54 | /// Позволяет получить путь к сборке. 55 | /// 56 | /// 57 | /// Сборка пукть к которой требуется получить. 58 | /// 59 | /// Пут к сборке. 60 | public static string GetPath(Assembly assembly) 61 | { 62 | string result = new Uri(assembly.CodeBase).LocalPath; 63 | return result; 64 | } 65 | 66 | /// 67 | /// Позволяет получить путь к каталогу .Net Framework. 68 | /// 69 | public static string GetDotNetRoot() 70 | { 71 | return Path.GetDirectoryName(GetPath(typeof(int).Assembly)); 72 | } 73 | 74 | /// 75 | /// Загружает проект или Solutin MSBuild. 76 | /// 77 | /// Путь к проекту 78 | public void LoadProjectFromFile(string prjPath) 79 | { 80 | if (prjPath == null) 81 | throw new ArgumentNullException("prjPath"); 82 | 83 | // Получаем путь к катлаогу где лежат dll-и с "целями" компиляции. 84 | string msBuildPath = GetDotNetRoot(); 85 | 86 | // Создаем хэлпер позволющий считывать проекты. 87 | _project = new Project(prjPath); 88 | } 89 | 90 | private Project _project; 91 | 92 | /// 93 | /// Возвращает ссылку на загруженный проект. 94 | /// 95 | public Project Project 96 | { 97 | get { return _project; } 98 | } 99 | 100 | /// 101 | /// Возвращает список путей к файлам проекта заданного типа. 102 | /// Можно задать ноль, один или несколько типов. 103 | /// Если не задать тип вообще, то будут возвращены все входящие 104 | /// в проект элементы. 105 | /// При выборке осущуществляются все провекрки условий и преобразований. 106 | /// 107 | /// Список типов 108 | /// Список путей к файлам. 109 | public IEnumerable GetProjectFiles(params string[] itemTypes) 110 | { 111 | // Копируем элементы из перечисленных в itemTypes групп в массив. 112 | List files = new List(200); 113 | 114 | if (itemTypes == null || itemTypes.Length == 0) 115 | foreach (ProjectItem item in Project.AllEvaluatedItems) 116 | yield return item.EvaluatedInclude; 117 | else 118 | foreach (string itemType in itemTypes) 119 | foreach (ProjectItem item in Project.GetItemsByEvaluatedInclude(itemType)) 120 | yield return item.EvaluatedInclude; 121 | } 122 | 123 | /// 124 | /// Возвращает список елементов проекта заданного типа. 125 | /// Можно задать ноль, один или несколько типов. 126 | /// Если не задать тип вообще, то будут возвращены все входящие 127 | /// в проект элементы. 128 | /// При выборке осущуществляются все провекрки условий и преобразований. 129 | /// 130 | /// 131 | public IEnumerable GetProjectItems(params string[] itemTypes) 132 | { 133 | // Копируем элементы из перечисленных в itemTypes групп в массив. 134 | List files = new List(200); 135 | 136 | if (itemTypes == null || itemTypes.Length == 0) 137 | foreach (ProjectItem item in Project.AllEvaluatedItems) 138 | yield return item; 139 | else 140 | foreach (string itemType in itemTypes) 141 | foreach (ProjectItem item in Project.GetItemsByEvaluatedInclude(itemType)) 142 | yield return item; 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace MSBuildProjectBrowser 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Application.EnableVisualStyles(); 16 | Application.Run(new MainForm()); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /MSBuildProjectBrowser/Resources/open_project_vs_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsdn/MSBuildProjectBrowser/70667c964137f8b5205c29ef7d030f5486cc7365/MSBuildProjectBrowser/Resources/open_project_vs_24.bmp -------------------------------------------------------------------------------- /MSBuildProjectBrowser/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MSBuildProjectBrowser 2 | 3 | A tool for viewing Visual Studio project files and other MSBuild files. 4 | 5 | Features: 6 | 1. View a source values and calculated values of properties and items. 7 | 2. Search for properties by prefix. 8 | 3. Search for properties by content (by substring). 9 | 4. Evaluation of expressions. For example: 10 | 11 | ![Properties](https://snag.gy/Y246tQ.jpg) 12 | 13 | 14 | ![Items](https://snag.gy/kFXnQK.jpg) 15 | --------------------------------------------------------------------------------