1

我编写了一个在模块“ DomainModule ”中使用的自定义属性,该属性在引用的程序集“Assembly A”中使用了一个帮助器类 属性定义在那里:

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class RidTabAttribute : Attribute

辅助类“Assembly A”使用“ Assembly B”或此处:Zepers.Ribb 将信息和资源带到模块视图中。

我收到下面提到的错误,请告诉我如何解决这个问题。

错误行:(在域模块中)

return type.GetCustomAttributes(typeof(T), true).OfType<T>();

错误概要:

{"Could not load file or assembly 'Zelopers.Ribb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Zelopers.Ribb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}

堆栈跟踪 :

Could not load file or assembly 'Zelopers.Ribb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 
or one of its dependencies. The system cannot find the file specified.

   at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
   at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
   at Zelopers.Prism.RibbonHelper.XamRibbonRegionBehavior.GetCustomAttributes[T](Type type) in e:\Wyrocco\ProjectsHall\Xz\Inside\Src\Common\Zepers.RibbonHelper\XamRibbonRegionBehavior.cs:line 58
   at Zelopers.Prism.RibbonHelper.XamRibbonRegionBehavior.ActiveViews_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in e:\Wyrocco\ProjectsHall\Xz\Inside\Src\Common\Zelopers.RibbonHelper\XamRibbonRegionBehavior.cs:line 40
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.NotifyAdd(IList items, Int32 newStartingIndex)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.NotifyAdd(Object item)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.OnItemMetadataChanged(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Microsoft.Practices.Prism.Regions.ItemMetadata.InvokeMetadataChanged()
   at Microsoft.Practices.Prism.Regions.ItemMetadata.DependencyPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Microsoft.Practices.Prism.Regions.Region.Activate(Object view)
   at Microsoft.Practices.Prism.Regions.SingleActiveRegion.Activate(Object view)
   at Microsoft.Practices.Prism.Regions.ContentControlRegionAdapter.<>c__DisplayClass2.<Adapt>b__1(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.NotifyAdd(IList items, Int32 newStartingIndex)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.NotifyAdd(Object item)
   at Microsoft.Practices.Prism.Regions.ViewsCollection.SourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Microsoft.Practices.Prism.Regions.Region.InnerAdd(Object view, String viewName, IRegionManager scopedRegionManager)
   at Microsoft.Practices.Prism.Regions.Region.Add(Object view, String viewName, Boolean createRegionManagerScope)
   at...Common\Zepers.Prism\Base\ModuleBase.cs:line 42
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)

错误消息框中的错误位置:

   {System.Object _CreateCaObject(System.Reflection.RuntimeModule, System.IRuntimeMethodInfo, Byte**, Byte*, Int32*)}
4

1 回答 1

1

在您调用以下行的项目中,

return type.GetCustomAttributes(typeof(T), true).OfType<T>();

添加Zelopers.Ribb作为参考。

于 2013-02-15T09:07:12.727 回答