public override AppDomain ProvideTemplatingAppDomain(string content)
 {
     if (domainHandle == null)
     {
         domainHandle = TextTemplatingService.GetTemplatingDomain();
     }
     return(domainHandle.Domain);
 }
Beispiel #2
0
 public IAsyncOperation Generate(IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
 {
     return(new ThreadAsyncOperation(delegate {
         using (var h = TextTemplatingService.GetTemplatingDomain()) {
             var host = (MonoDevelopTemplatingHost)h.Domain.CreateInstanceAndUnwrap(
                 typeof(MonoDevelopTemplatingHost).Assembly.FullName,
                 typeof(MonoDevelopTemplatingHost).FullName);
             var defaultOutputName = file.FilePath.ChangeExtension(".cs");                      //cs extension for VS compat
             host.ProcessTemplate(file.FilePath, defaultOutputName);
             result.GeneratedFilePath = host.OutputFile;
             result.Errors.AddRange(host.Errors);
             foreach (var err in host.Errors)
             {
                 monitor.Log.WriteLine(err.ToString());
             }
         }
     }, result));
 }