2012-04-07 34 views
2

この作品は私がこの1つに移している別のアプリケーション用です。私は数時間ここにこだわってきたし、GoogleはMEFのための多くを持っていません。はい、System.ComponentModel.Composition.dllがインポートされます。しかし、まだこのエラーを取り除くことはできません。タイプまたは名前空間の名前 '...'が見つかりませんでした(使用するディレクティブまたはアセンブリ参照がありませんか?)

は、私は、私のためにこれを持っている:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Windows.Forms; 
using System.ComponentModel.Composition; 
using JSNet; 

影響を受けるコード:

var catalog = new AggregatingComposablePartCatalog(); 
var mainAssemblyCatalog = new AttributedAssemblyPartCatalog(this.GetType().Assembly); 
var jsNetCatalog = new AttributedAssemblyPartCatalog(typeof(Effect).Assembly);    
//var addInEffects = new DirectoryPartCatalog("Effects"); 

catalog.Catalogs.Add(mainAssemblyCatalog); 
catalog.Catalogs.Add(jsNetCatalog); 
//catalog.Catalogs.Add(addInEffects); 
var container = new CompositionContainer(catalog); 

エラー:

Error 1: The type or namespace name 'AggregatingComposablePartCatalog' could not be found (are you missing a using directive or an assembly reference?) 

Error 2: The type or namespace name 'AttributedAssemblyPartCatalog' could not be found (are you missing a using directive or an assembly reference?)  

Error 3: The type or namespace name 'AttributedAssemblyPartCatalog' could not be found (are you missing a using directive or an assembly reference?)  

Error 4: The type or namespace name 'CompositionContainer' could not be found (are you missing a using directive or an assembly reference?) 
+1

"imported"とは、あなたのプロジェクトへの参照としてアセンブリが追加されたことを意味しますか? –

+1

これは完全に正当なものかどうかはわかりませんが、.netフレームワークのバージョンがクライアントプロファイルに設定されているときにこの問題が発生したことを覚えています。あなたのアプリケーションのフレームワーク参照を確認できますか? (これはコンソール/ Windowsアプリだと仮定) –

+3

あなたの悩みを説明することは、本当にわかりやすいタイトルにはなりません。 –

答えて

7

チェックし、アプリケーションのフレームワークのバージョンがクライアントプロファイルに設定されている場合。そうであれば、これがあなたの問題です。参照しているアセンブリがクライアントプロファイルをターゲットにしていない可能性があります。それを.NET 4.0(4.0クライアントプロファイルではない)に変更してください

関連する問題

 関連する問題