类型或名称空间名称'...'找不到(您是否缺少using指令或程序集引用?) [英] type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?)

查看:68
本文介绍了类型或名称空间名称'...'找不到(您是否缺少using指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这项工作对我要转移到该应用程序中的另一个应用程序很好.我已经在这里停留了几个小时,而Google对于MEF来说并没有太多. System.ComponentModel.Composition.dll是导入的,是的.但是仍然无法摆脱这个错误.

This work's fine for another app that I'm transferring into this one. I've been stuck here for hours and google does not have much for MEF. the System.ComponentModel.Composition.dll is imported, yes. But still cannot get rid of this error.

我有这个用于我的物品:

I have this for my includes:

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?)

推荐答案

检查您的应用程序的框架版本是否设置为客户端配置文件".如果是这样,这就是您的问题.您引用的程序集可能没有针对客户端配置文件".将其更改为.NET 4.0(不是4.0 Client Profile)

Check if your app's framework version is set to Client Profile. If it is, this is your problem. The assembly you're referencing likely isn't targeting Client Profile. Change it to .NET 4.0 (not 4.0 Client Profile)

这篇关于类型或名称空间名称'...'找不到(您是否缺少using指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆