2

これは、このアプリに転送する別のアプリでは問題ありません。私はここで何時間も立ち往生しており、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?)
4

1 に答える 1

7

アプリのフレームワークバージョンがクライアントプロファイルに設定されているかどうかを確認します。もしそうなら、これはあなたの問題です。参照しているアセンブリは、クライアントプロファイルを対象としていない可能性があります。.NET 4.0(4.0クライアントプロファイルではない)に変更します

于 2012-04-07T03:08:10.990 に答える