Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

[VS2010 T4] Any way to obtain name of the current project?

$
0
0

Hello! There's a template which traverses all files in solution and generates helpers for some of them. Currently the bootstrap part looks like

string projectName = "SomeProject";
IServiceProvider serviceProvider = (IServiceProvider)this.Host;
DTE dte = (DTE)serviceProvider.GetService(typeof(DTE));
Project currentProject = dte.Solution.Projects.Cast<Project>().Single(p=>p.Name == projectName);
Visit(currentProject);

Now I'm need to create reusable template, so, I need a way to obtain the name of the current project without hardcoding it. Any suggestions?

Thanks!


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>