private static string FindTemplateAssertExists(Project project, IFileSystem fileSystem, string template)
{
string templateFullPath = template;
if (!Path.IsPathRooted(templateFullPath)) {
var templateProjectItem = project.GetProjectItem(templateFullPath);
if (templateProjectItem != null)
templateFullPath = templateProjectItem.GetFullPath();
}
if (!fileSystem.FileExists(templateFullPath)) {
throw new FileNotFoundException(string.Format("Cannot find template at '{0}'", templateFullPath));
}
return templateFullPath;
}