Hi,

I'm developing a windows service with c#. Now I'm trying to use a .net class
library (dll) to include.
For this I added the dll to my references. But unfortunately if i run the
service i got always this error:

File or assembly name "myClassLibrary", or one of its dependencies, was not
found.

Does someone knows where i have to place my dll that it could be found by my
windows service.
I already tryied to place it in the System32 folder and also in the same
folder as the windows service is. But without any success. :(

Thank you for your help!

Best Regards,
Michael




----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

Re: Usage of .net class lib in a windows service by Dmitriy

Dmitriy
Mon Jan 10 06:52:46 CST 2005

Hi,

The simplest solution would be to put the assembly in the GAC.
Also, you can utilize Fusion Log Viewer (fuslogvw.exe) upon service start-up
to see which locations are probed for the class library assembly.
If your service is an .exe, you can also probably use the configuration file
to specify additional probing paths for the class library assembly.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Michael Ulmann" <ukmichael@hotmail.com> wrote in message
news:41dcf9b5$1_2@127.0.0.1...
> Hi,
>
> I'm developing a windows service with c#. Now I'm trying to use a .net
> class library (dll) to include.
> For this I added the dll to my references. But unfortunately if i run the
> service i got always this error:
>
> File or assembly name "myClassLibrary", or one of its dependencies, was
> not found.
>
> Does someone knows where i have to place my dll that it could be found by
> my windows service.
> I already tryied to place it in the System32 folder and also in the same
> folder as the windows service is. But without any success. :(
>
> Thank you for your help!
>
> Best Regards,
> Michael
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet
> News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000
> Newsgroups
> ---= East/West-Coast Server Farms - Total Privacy via Encryption =---


Re: Usage of .net class lib in a windows service by Adam

Adam
Mon Jan 10 18:09:34 CST 2005

Yes, I'd suggest Strong Naming the myClassLibrary.dll assembly and
installing it into the Global Assembly Cache (GAC). Here's how to do
it, in case you don't know how:

1.) Open up the Visual Studio .NET Command Prompt from the Start Menu
Program Item link
2.) Navigate to a directory where you'd like to store your
public/private key pair file (e.g. C:\MyKeys)
3.) Generate a public/private key pair using the following command:
sn -k myKeyPair.snk
4.) Add the following to your AssemblyInfo.cs file in your Project for
myClassLibrary:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyKeyFile(@"C:\MyKeys\myKey.snk")]
Change the version to whatever you'd like and the AssemblyKeyFile path
to the appropriate path to the location of your key pair file.
5.) Build your assembly
6.) Install your assembly in the GAC with the following command:
gacutil /i myClassLibrary.dll

Your Windows Service should now be able to find your assembly. Let me
know if it works for you.


Re: Usage of .net class lib in a windows service by Adam

Adam
Mon Jan 10 18:12:31 CST 2005

[assembly: AssemblyKeyFile(@"C:\MyKeys\myKey.snk")] should read
[assembly: AssemblyKeyFile(@"C:\MyKeys\myKeyPair.snk")] above to be
consistent with step 3.