1

モジュール「DomainModule 」で使用するカスタム属性を作成しました。属性は、参照アセンブリ「アセンブリ A」のヘルパー クラスを使用します 。属性定義は次のとおりです。

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

また、ヘルパー クラス「アセンブリ A」「アセンブリ 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 に答える