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引用,随便写点代码,如:
编译,通不过,
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.问题解决。
在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.问题解决。
相关文章推荐
- .net4 wpf App 使用log4net 错误:The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?)
- 如何解决The type or namespace name 'ScriptService' could not be found (are you missing a using directive or an assembly reference?)
- The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an asse
- The type or namespace name '***' could not be found (are you missing a using directive or an asse
- The type or namespace name `MovieTexture' could not be found. Are you missing an assembly reference?
- 关于错误 The type or namespace name `Vuforia' could not be found. Are you missing an assembly reference?
- could not be found (are you missing a using directive or an assembly reference?)
- `UnityEditor' could not be found Are you missing a using directive or an assembly reference?
- 菜鸟写给菜鸟——The type or namespace name '****' could not be found (are you missing a using directive or an assembly reference
- Compiler Error Message: CS0234: The type or namespace name 'BorderDetails' does not exist in the class or namespace 'Infragistics.WebUI.Shared' (are you missing an assembly reference?)
- Compiler Error Message: CS0234: The type or namespace name ''(are you missing an assembly reference?)
- Unity发布时出现“The type or namespace name `UnityEditor' could not be found.”
- Unity发布时出现“The type or namespace name `UnityEditor' could not be found.” 错误
- Unity使用FXMaker导致发布时报“The type or namespace name `UnityEditor' could not be found” 解决备忘
- MSbuild failure: error CS0246: The type or namespace name 'DataLoader_Accessor' could not be found
- The type or namespace name 'DbContext' could not be found-vs2012
- WCF分布式开发常见错误(4):The type or namespace name 'DataContract' could not be found DataContract找不到
- The type or namespace name 'AjaxControlToolkit' could not be found in the global namespace
- The type or namespace name 'AjaxControlToolkit' could not be found in the global namespace