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

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

问题描述

我正在Windows服务中使用类库.
我已经添加了dll以及使用了derective的dll,但是仍然给我错误"找不到类型或名称空间名称" SSCommuniLib(您是否缺少using指令或程序集引用?) "

我多次删除并添加了dll,但仍然无法正常运行.

给我警告
警告1无法解析引用的程序集"SSCommuniLib,版本= 1.0.0.0,区域性=中性,processorArchitecture = MSIL",因为它依赖于"System.Web,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a ",它不在当前目标框架".NETFramework,Version = v4.0,Profile = Client"中. LeadsolarService

I am using a class library in my windows service.
I have added the dll as well as used using derective, but still it is giving me error "The type or namespace name ''SSCommuniLib'' could not be found (are you missing a using directive or an assembly reference?)"

I removed and added the dll several times but still it is not working.

It is giving me warning
Warning 1 The referenced assembly "SSCommuniLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" 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". LeadsolarService

推荐答案

您没有使用using指令添加任何内容.您完全误解了它的目的.它仅用于更改某些名称空间的代码中类型的命名.它根本与程序集无关,仅与名称空间有关.例如,可以缩短代码中类型的命名,而无需指定包括名称空间部分在内的全名.一个程序集可以使用不同的名称空间名称空间,而同一名称空间可以在不同的程序集中使用-这些东西是完全独立的.

.NET的中心概念是程序集.它们彼此之间通过引用一个程序集来相互使用(以及在运行时通过反射并加载程序集,或者甚至在运行时使用System.Reflection.Emit创建它们,我们暂时不考虑这一点).您可以使用添加引用"来引用项目中的程序集-请参阅Visual Studio解决方案资源管理器下的项目树.在编译器级别,有适当的命令行参数可用于引用程序集.

—SA
You are not adding anything with using directive. You totally misunderstood its purpose. It is only used to change the naming of the types in the code of some namespace. It is not related to assemblies at all, it is only related to namespaces; for example, naming of the types in the code can be shortened, without specifying full names including namespace parts of the names. And one assembly can use different namespaces namespaces, and the same namespace can be used in different assemblies — these things are totally independent.

The central notion of .NET is the assembly. They use each other using referencing of one assembly by another (and also, via Reflection and loading assemblies during runtime or even creating them during runtime using System.Reflection.Emit — let''s not consider this at the moment). You can reference assemblies in your project, by using "Add Reference" — see the project tree under Visual Studio Solution Explorer. At the level of compilers, there are appropriate command line parameters for referencing assemblies.

—SA


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

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