Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows library service
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
Posted 20-Nov-12 4:51am
Edited 20-Nov-12 18:02pm
v4
Comments
Timberbird at 20-Nov-12 9:54am
   
Since it's a service... have you tried putting your assembly to GAC?
ascentit solutions at 20-Nov-12 9:57am
   
it was working fine earlier but after making some minor changes in class lib it started giving me error
Timberbird at 20-Nov-12 10:05am
   
When do you receive this message? When you build your project or during runtime?
ascentit solutions at 20-Nov-12 10:13am
   
during building
Timberbird at 20-Nov-12 11:04am
   
Well, if you didn't change any namespace/class name and also checked spelling (for example, using Ctrl+F)... have you tried to clean and rebuild the project?
Sergey Alexandrovich Kryukov at 20-Nov-12 16:05pm
   
It's pretty much apparent OP did not reference anything, which you can see by looking at "using" directive mentioned. Please see my answer.
--SA
Jason Gleim at 20-Nov-12 13:46pm
   
Is the class lib is a separate project? If so, how did you add a reference to the DLL in your service project? Did you reference the actual DLL or did you add it as a linked project?
 
If the DLL is a different project, and you linked to the DLL, you may have that link set to use a specific version of the DLL in the service project. In that case, if you change the DLL, and rebuild it, the versions won't match and your service project won't be able to resolve the specific version of the DLL it is looking for.
Sergey Alexandrovich Kryukov at 20-Nov-12 16:06pm
   
It's pretty much apparent OP did not reference anything, which you can see by looking at "using" directive mentioned. Please see my answer.
--SA
ascentit solutions at 20-Nov-12 22:52pm
   
I think you (Jason Gleim) are correct . Can you help me out . How can i solve it now .
Jason Gleim at 22-Nov-12 22:54pm
   
Anytime you use a class from a DLL it must be referenced in your project. Start by making sure that when you expand the references node, you see the DLL listed. If it has a yellow bang on it, there is a problem. Right-click and select properties to see the info on the DLL. There is a property, Use Specific Version, that may be set to True. If so, and you have linked the DLL in from the other project's bin directory, that is your problem.
 
Alternately, you can add the DLL project to your solution, delete the reference to it in your service project, and then add it back as a project... (it will list it on the projects tab in the DLL chooser) not a dll. When you do that, VS is smart enough to deal with the builds.
 
HTH

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100