T4 Will Not Run if Project is Not Selected #100

Closed
ianlee74 opened this Issue Feb 23, 2012 · 1 comment

Comments

Projects
None yet
2 participants

In VS2010, if I try to run the T4 template and the project that contains the T4 template is not selected/highlighted then the template will throw an exception and will not run. To get around this, I have added the following line as a reminder but I suspect there is a more elegant solution that could be used based on discovering the name of the current project rather than looking for "active" projects.

In PetaPoco.Core.ttinclude...

public EnvDTE.Project GetCurrentProject() {
...
Array activeSolutionProjects = (Array)dte.ActiveSolutionProjects;
if (activeSolutionProjects == null)
throw new Exception("DTE.ActiveSolutionProjects returned null");

*** BEGIN: I ADDED THIS ***

if(activeSolutionProjects.Length == 0)
    throw new Exception("You must select/click the project that is generating the POCOs before running the template.");

*** END: I ADDED THIS ***
...
}

Owner

pleb commented Dec 5, 2015

I'm sorry that your issue has been left for so long. In an effort to reboot PetaPoco your issue has been closed. If you think this is still a problem. Please feel free to open and another issue. Please pass the word on that PetaPoco is back. We're looking for people #204.

@pleb pleb closed this Dec 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment