您的位置:首页 > Web前端

The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly refere

2010-12-29 22:42 776 查看
今天碰到一个问题,其实之前也有碰到过。

在visual studio 2010创建控制台程序的时候(其它项目还不知道会不会有同样的问题)。

添加log4net.dll引用,随便写点代码,如:

static void Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
}
}


编译,通不过,

Error 1 The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Joe\Desktop\sample\sample\ConsoleApplication1\Program.cs 5 7 ConsoleApplication1
奇怪啊,怎么就报错了啊。重新打开visual studio 2010,新建项目,重新添加应用,问题照旧。

这是发现一个提示:

Warning 1 The referenced assembly "log4net" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. ConsoleApplication1
问题出来,打开项目属性,恶作剧原来在此啊,



晕啊,自作多情,干嘛新建项目的时候要自动选择.net framework 4 client profile。

重新选择.net framework 4.问题解决。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐