プリズムライブラリに付属するSystem.Windows.Interactivity dllをロードまたは解決する永続的な問題があるC#/ WPF Prism(v4.0)アプリケーションがあります。私はこの問題をデバッグ/解決しようと3日間真っ直ぐ努力してきました。私は.Netのアセンブリ解決についての話を学んだが、これまでのところ問題はなかったので、私はStackOverflowコミュニティに助けを求める絶望的な嘆願書に目を向けると思った。 :)プリズムアセンブリの参照に失敗しました:System.Windows.Interactivity
私は、動作を追加するためにSystem.Windows.Interactivityを参照する必要がある、より大きなPrismアプリケーションの一部として実行されるモジュールを持っています。したがって、私は次のように名前空間を指定するXAMLユーザーコントロールを持っている:
<UserControl x:Class="MyApp.Modules.SourcesModule.myView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
そして私は次のようにそのユーザーコントロールの子要素に動作を設定しようとしています:
奇妙0<ListBox Name="myListBox">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SomeCommandOrOther}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
、プロジェクトを関連するコードビハインドファイルとを入力すると、System.Windows.Interactivity名前空間のオブジェクトに対してIntellisense自動補完を取得することもできます。
ただし、実行時にのみ、上記のListBox要素でXamlParseExceptionが発生します。
Could not load file or assembly 'System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
のInnerExceptionは、私は、アセンブリ決議について読んでから学んだように、型System.IO.FileNotFoundException
"Could not load file or assembly 'System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35"
...であり、通常は強力な名前のアセンブリを解決する問題を示唆単にディスク上でdllを見つけることができない(例外タイプが示唆するように)
=== Pre-bind state information ===
LOG: User = aricebo-array\me
LOG: DisplayName = System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35 | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/me/Documents/Development Projects/Desktop apps/Prism/MyApp/Src/MyApp/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/me/Documents/Development Projects/Desktop apps/Prism/MyApp/Src/MyApp/bin/Debug/System.Windows.Interactivity.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/Development Projects/Desktop apps/Prism/MyApp/Src/MyApp/bin/Debug/System.Windows.Interactivity/System.Windows.Interactivity.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/Development Projects/Desktop apps/Prism/MyApp/Src/MyApp/bin/Debug/System.Windows.Interactivity.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/Development Projects/Desktop apps/Prism/MyApp/Src/MyApp/bin/Debug/System.Windows.Interactivity/System.Windows.Interactivity.EXE.
興味深いことに、私はIL逆アセンブラ(Ildasm.exeを)を使用して、私の建てたプロジェクト、システムを見れば、:問題のアセンブリのための部分的な結合に関する警告を含め、次のように
フュージョンログ情報があります.Windows.Interactivityは参照されているアセンブリの1つとしてマニフェストにはリストされていませんが、その他の参照されたプリズムDLLはそこまでうまく表示されます。たとえば:Referencing the correct System.Windows.Interactivity dll from Prism application:
.assembly extern Microsoft.Practices.Prism
{
.publickeytoken = (31 BF 38 56 AD 36 4E 35) // 1.8V.6N5
.ver 4:0:0:0
}
.assembly extern Microsoft.Practices.Unity
{
.publickeytoken = (31 BF 38 56 AD 36 4E 35) // 1.8V.6N5
.ver 2:0:414:0
}
この問題は、この他にStackOverflowの質問で述べたものと類似しています。ただし、そこに記載されている規定のソリューション(つまり、PrismバージョンのSystem.Windows.Interactivityを使用しています)に従っていますが、無駄です。ちょうど楽しみのために、私はExpression Blend 3と4の両方のSDK(別々のコース)に付属しているSystem.Windows.Interactivity dllを使ってみましたが、どちらにも不運です。
私はSystem.Windows.Interactivity dllをどのようにロードしたのか、Prismライブラリに付属している他のすべてのdllをどのようにロードしたのか(ライブラリはすべて/ libフォルダにあります) Visual Studio 2010の "参照の追加"> "参照"メニューを使用してそれらを追加しました。ディスク上のこれらのDLLをすべて1つのディレクトリに置いて指定します)
次に進む場所最も高く評価されるでしょう!どうもありがとう。
GACにはバージョンがありますか?あなたは '任意のCPU'を構築し、devで64ビットを参照していますが、実行時に32ビットのバインドをしていますか? FWIW、私は手がかりを持っていません。 –
'gacutil -l'は、GACにSystem.Windows.Interactivityのバージョンがないことを確認します。あなたの質問に答えるために、私はプロジェクトのプロパティのプラットフォームターゲットとして "Any CPU"を構築しています。私のテストマシン/ OSは64ビットです。しかし、実行時に32ビットのバインドに関する質問に答えるには十分ではありません。どうすればそれをチェックするかも教えていただけますか?ありがとう! –
x86として構築して何が起こるかを見てください –