„Entry Point Not Found“ Fehler, wenn der Text Templating Engine im VS 2008 SDK

StackOverflow https://stackoverflow.com/questions/690585

  •  22-08-2019
  •  | 
  •  

Frage

Ich bin mit der Microsoft.VisualStudio.TextTemplating.Engine Klasse aus den SDK VS 2008 zusammen mit den Objekten aus dem Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates Namespace, den Prozess der Erstellung von C # -Klassen von T4-Vorlagen zu automatisieren.

Hier mein Code. Es genommen direkt aus dem Beispiel auf Oleg Sych des Blog ...

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates;
using Microsoft.VisualStudio.TextTemplating; 

namespace PropertyDirectivePot
{
  class Program
  {
    static void Main(string[] args)
    {
      // Prepare template parameters
      var arguments = new Dictionary<string, PropertyData>();
      arguments.Add(“MyProperty”,
        new PropertyData(Color.AntiqueWhite, typeof(Color))); 

      // Initialize GAX template host
      string currentDirectory = Directory.GetCurrentDirectory();
      TemplateHost host = new TemplateHost(currentDirectory, arguments);
      host.TemplateFile = Path.Combine(currentDirectory, “PropertyTest.tt”); 

      // Transform template
      string template = File.ReadAllText(host.TemplateFile);
      ITextTemplatingEngine engine = new Engine();
      string output = engine.ProcessTemplate(template, host); 

      // Save output
      string outputFile = Path.ChangeExtension(host.TemplateFile, “.txt”);
      File.WriteAllText(outputFile, output);
    }
  }
}

Das Problem

Ich erhalte eine System.EntryPointNotFoundException an dem Punkt, in dem die Vorlage verarbeitet wird, und die Ausgangscode-Datei zurückgegeben werden soll ...

string output = engine.ProcessTemplate(template, host);

Diese Ausnahme schlägt vor, dass ich eine Komponente Versionskonflikt irgendwo haben, und

scroll top