【问题标题】:Assembly not found error未找到装配错误
【发布时间】:2013-05-26 12:20:21
【问题描述】:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using WebcamControl;
    using System.Drawing.Imaging;
    using Microsoft.Expression.Encoder;
    using System.Reflection;

    namespace SMS
    {
    /// <summary>
    /// Interaction logic for camphoto.xaml
    /// </summary>
    public partial class camphoto : Window
    {
        public camphoto()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
            Binding bndg_1 = new Binding("SelectedValue");
            bndg_1.Source = comboBox1;
            webcam1.SetBinding(WebcamControl.Webcam.VideoDeviceProperty, bndg_1);

            //set properties
            webcam1.PictureFormat = ImageFormat.Jpeg;

            webcam1.FrameRate = 30;
            webcam1.FrameSize = new System.Drawing.Size(320, 240);

            comboBox1.SelectedIndex = 0;
            string str = Microsoft.Expression.Encoder.Devices.EncoderDeviceType.Video.ToString();

                FindDevice();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void FindDevice()
        {
            var vidDevice = Microsoft.Expression.Encoder.Devices.EncoderDevices.FindDevices(Microsoft.Expression.Encoder.Devices.EncoderDeviceType.Video);
            foreach (var data in vidDevice)
            {
                comboBox1.Items.Add(data.Name);
            }
        }
    }
}

嗨朋友,这是我的代码,它是网络摄像头的预览。但是当我调试它时会出现一个错误。

“找不到文件异常被咳嗽:无法加载文件或程序集 'Microsoft.Expression.Encoder,版本=4.0.0.0,文化=中性, PublicKeyToken=31bf3856ad364e35' 或其依赖项之一。这 系统找不到指定的文件。”

我已经将Microsoft.Expression.Encoder 引用添加到项目引用中。但我不明白它为什么会来。请帮帮我。

【问题讨论】:

    标签: c# .net wpf


    【解决方案1】:

    转到 Project Properties -> Build 部分并将 Platform target 更改为 x86

    【讨论】:

      【解决方案2】:

      您是否检查过您的项目配置文件不是".Net Framework 4.0 Client Profile"。如果有请改成".Net Framework 4.0"

      还要确保引用部分具有 dll 引用。尝试清理解决方案,然后重新构建并交叉验证 bin 目录中的 dll 一次。

      【讨论】:

      • 是的!它已经在项目应用程序属性中选择为 .net framework 4.0。没有出现任何效果。
      • 检查参考部分是否有除4.0以外的其他版本。
      • 也尝试清空 ASP.Net 临时文件夹,然后检查一次
      • 我检查了很多次,但我不明白为什么它会出现?我在 wpf 中使用它
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-13
      • 2016-11-05
      • 1970-01-01
      • 2019-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多