从另一个类派生一个类会导致Com注册错误

时间:2014-09-02 11:44:52

标签: c# wpf class inheritance

我有一个遵循WPF / MVVM模式的项目。我试图从PropertyChangedBase派生我的ViewModel类,以便我可以通知视图的数据更改。一旦从PropertyChangeBase派生类并编译,我就会收到错误说

错误1无法注册程序集" D:\ Source \ ArcOnline \ bin \ Debug \ ArcOnline.dll"。无法加载文件或程序集' Major,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = null'或其中一个依赖项。系统找不到指定的文件。

这是我的课程定义方式

using ArcOnline.WPF;
using System;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace ArcOnline.ViewModels
{
    /// <summary>
    /// The class handles the template for a single 
    /// </summary>
    public class TemplatesViewModel : PropertyChangedBase
    {
        /// <summary>
        /// 
        /// </summary>
        public ArcOnlineViewModel ArcManager { get; set; }

        private string _layerID;
        /// <summary>
        /// Layer ID
        /// </summary>
        public string LayerID
        {
            get { return _layerID; }
            set { _layerID = value; NotifyOfPropertyChange(() => LayerID); }
        }

        private string _title;
        /// <summary>
        /// Title of the layer
        /// </summary>
        public string Title
        {
            get { return _title; }
            set { _title = value; NotifyOfPropertyChange(() => Title); }
        }

.............如上所述更多属性     }

以下是我的PropertyChangedBase的定义方式

using Component.Linq.Expressions;
using System;
using System.Collections;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Runtime.Serialization;
using System.Xml.Serialization;
#endregion

namespace Component.ComponentModel
{
    /// <summary>
    /// A base class from which ViewModels can inherit to improve the quality of
    /// patterns such as INotifyPropertyChanged.
    /// </summary>
    [DataContract]
    [Serializable]
    public class PropertyChangedBase : INotifyPropertyChanged, INotifyDataErrorInfo, IDataErrorInfo
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyChangedBase"/> class.
        /// </summary>
        public PropertyChangedBase()
        {
            ErrorsChanged += Notify_ErrorChanged;
        }

        void Notify_ErrorChanged(object sender, DataErrorsChangedEventArgs e)
        {
            NotifyOfPropertyChange(() => Error);
        }

 ...... More class definition continues

}

此PropertyChangedBase实际上是在另一个Project中定义的,这就是它包含所有头文件的原因。如果我复制这个PropertyChangedBase类的代码并在我自己的Project中创建一个新类,其中定义了TemplatesViewModel然后使用它,它就可以正常工作。

我只是想知道它在第一种情况下不起作用的原因是什么?这浪费了我一整天!!

提前致谢

0 个答案:

没有答案
相关问题