代码之家  ›  专栏  ›  技术社区  ›  Andy McCluggage hunter

在VS 2008 SDK中使用文本模板引擎时出现“未找到入口点”错误

  •  1
  • Andy McCluggage hunter  · 技术社区  · 16 年前

    我正在使用 Microsoft.VisualStudio.TextTemplating.Engine Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates

    这是我的密码。它直接从上面的示例中获取 Oleg Sych's 博客

    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);
        }
      }
    }
    

    问题

    我得到一份工作 System.EntryPointNotFoundException 在处理模板并返回输出代码文件时。。。

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

    这个异常表明我在某个地方有一个组件版本不匹配,并且 googling 我发现其他人也遇到过这个问题,但我使用的组件版本要旧得多。我的版本是。。。

    Visual Studio SP19.0.30729.1
    Microsoft.VisualStudio.textTemplateing
    Microsoft.Practices.RecipeFramework.VisualStudio.Library

    我有最新版本的GAX、GAT和VS2008 SDK(今天下载并安装)。

    有人知道发生了什么事,或者我如何进一步调查吗?

    如果可能的话,我真的不想开始使用跟踪器来跟踪调用堆栈:(

    1 回复  |  直到 15 年前
        1
  •  1
  •   Andy McCluggage hunter    16 年前

    我引用了错误的版本 Microsoft.VisualStudio.TextTemplating 装配

    • 8.1.0.0

    Microsoft.Practices.RecipeFramework.VisualStudio.Library 我使用的是两个版本中较早的版本。