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

今天碰到一个问题,其实之前也有碰到过。

在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.问题解决。

转载于:https://www.cnblogs.com/joe-yang/archive/2010/12/29/1921187.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值