【问题标题】:Getting error like are you missing an assembly reference in my program出现错误,例如您是否在我的程序中缺少程序集引用
【发布时间】:2011-09-27 04:27:16
【问题描述】:

我在 .net 框架 3.5 中使用此代码,用于在 win 7 中使用 Visual Studio 2010 Professional 创建语法,但出现类似错误 系统中不存在类型或命名空间名称“Speech”(您是否缺少 using 指令或程序集引用。

找不到类型或命名空间名称“SpeechRecognitionType”(您是否缺少 using 指令或程序集引用,

类似 linq 类型的其他类型不存在,您是否缺少程序集引用。

`使用系统; 使用 System.Collections.Generic; 使用 System.ComponentModel; 使用 System.Data; 使用 System.Drawing; 使用 System.Linq; 使用 System.Text; 使用 System.Windows.Forms; 使用 System.Speech.Recognition; 使用 System.Threading;

命名空间 SpeechRecogTest { 公共部分类Form1:表格 { SpeechRecognitionEngine sr = new SpeechRecognitionEngine();

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        //Create grammar
        Choices words = new Choices(); 
        words.Add("Hi");
        words.Add("No");
        words.Add("Yes");

        Grammar wordsList = new Grammar(new GrammarBuilder(words));

        wordsList.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(rec_SpeechRecognized);
        sr.LoadGrammar(wordsList);

    }

    void rec_SpeechRecognized(object sender, RecognitionEventArgs e)
    {
        MessageBox.Show(e.Result.Text);
    }
}

}`

【问题讨论】:

    标签: asp.net visual-studio-2010


    【解决方案1】:

    当它询问“您是否缺少 using 指令或程序集引用”?您没有错过 using 指令,因此很可能您错过了程序集。右键单击“参考”=>“添加参考”=> NET 选项卡 => System.Speech dll。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-01
      相关资源
      最近更新 更多