Skip to content

Instantly share code, notes, and snippets.

@kazuk
Created July 26, 2013 01:50
Show Gist options
  • Save kazuk/6085409 to your computer and use it in GitHub Desktop.
Save kazuk/6085409 to your computer and use it in GitHub Desktop.
Enumerate Project Property
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="EnvDTE" #>
<#@ import namespace="EnvDTE" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.ComponentModel" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".txt" #>
<#
EnumerateHostProjectProperty();
#>
<#+
public void EnumerateHostProjectProperty()
{
var sp = Host as IServiceProvider;
var dte = (DTE)sp.GetService( typeof( DTE ) );
var projItem = dte.Solution.FindProjectItem( Host.TemplateFile );
var project = projItem.ContainingProject;
foreach( Property item in project.Properties )
{
#>
<#=item.Name#> <#=item.Value#>
<#+
}
}
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment