Could not load file or assembly 'WeOnlyDo.Securit - WeOnlyDo Discussion board

Could not load file or assembly 'WeOnlyDo.Securit (wodSFTP / wodSFTP.NET / wodSFTPdll)

by insrod, Wednesday, November 23, 2011, 11:26 (4510 days ago)

Hi,
I am facing the below error and have been trying to fix it for over 2 weeks.
Could not load file or assembly 'WeOnlyDo.Security.Cryptography.KeyManager, Version=2.0.3.20 or one of its dependencies.

Can someone pl help me with this? This is working on our dev server, but not in the Test servers.

Regards,
Sid

Re: Could not load file or assembly 'WeOnlyDo.S

by woddrazen, Wednesday, November 23, 2011, 11:28 (4510 days ago) @ insrod

Hi Sid,


What happens if you compile your project as 32bit (x86) project? Does that help maybe?

Let us know how it goes.


Regards,
Drazen

Re: Could not load file or assembly 'WeOnly

by insrod, Wednesday, November 23, 2011, 11:37 (4510 days ago) @ woddrazen

Hi Drazen,

Our project is built on 32-bit (.Net2.0) and our servers are also x-86 family servers.
The code is working on one environment where the project was built. When the dll is moved to other environment, it is giving the above exception.

Please help!!!

Regards,
Sid

Re: Could not load file or assembly

by woddrazen, Wednesday, November 23, 2011, 11:44 (4510 days ago) @ insrod

Sid,


Can you please confirm that WeOnlyDo.Security.Cryptography.KeyManager.dll is distributed with your application to problematic machine?

Most probably it should be located inside your application folder.


Drazen

Re: Could not load file or assembly

by insrod, Wednesday, November 23, 2011, 11:59 (4510 days ago) @ woddrazen

Hi Drazen,

Earlier, we had copied the dll from the dev environment to the GAC of PROBLEMATIC Server.

Now, after reading your post, we have run the set up and copied the dll from Application Data folder to the GAC of the PROBLEMATIC server.

Now, we are getting a NEW error:
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


Regards,
Sid

Re: Could not load file or assembly

by woddrazen, Wednesday, November 23, 2011, 12:12 (4510 days ago) @ insrod

Sid,


Can you please inside your project set for WeOnlyDo.Security.Cryptography.KeyManager Copy Local Property to True.

In that case WeOnlyDo.Security.Cryptography.KeyManager.dll should be distributed with your application.

So WeOnlyDo.Security.Cryptography.KeyManager.dll will be located inside your application folder. Does it work like that maybe?


Drazen

Re: Could not load file or assembly

by insrod, Wednesday, November 23, 2011, 12:19 (4510 days ago) @ woddrazen

Hi Drazen,

The local property is already set to true.

Moreover, we are not distributing our application in the form of set up. It generates a dll which is copied to the PROBLEMATIC environment.


Please share your phone details so that we can explain better.

Regards,
Sid

Re: Could not load file or assembly

by woddrazen, Wednesday, November 23, 2011, 12:36 (4510 days ago) @ insrod

Sid,


Unfortunately we don't provide support over a phone. So you are not building standard exe application?

Can you maybe explain us which type of application you are creating?

Also, which version of Visual Studio you are using?


Drazen

Re: Could not load file or assembly

by insrod, Wednesday, November 23, 2011, 13:53 (4510 days ago) @ woddrazen

Hi Drazen,

We are building a SharePoint Timer job. It generates a dll and the same is shared across different environments. We are using VS2008/.Net 2.0 (target framework).

I have already mentioned the scenarios when i am getting the 2 different types of errors.

What is the step by step procedure to use wodSFTP dlls in our application? What are the dependent files and assemblies required?


Regards,
Sid

Re: Could not load file or assembly

by woddrazen, Wednesday, November 23, 2011, 14:28 (4510 days ago) @ insrod

Sid,


You only need to distribute WeOnlyDo.Client.SFTP.dll file with your application.

If you are using public key authentication inside of your application, you also need to distribute WeOnlyDo.Security.Cryptography.KeyManager.dll.

So if you aren't using public key authentication you don't need to include inside your project WeOnlyDo.Security.Cryptography.KeyManager.dll


Drazen

Re: Could not load file or assembly

by insrod, Wednesday, November 23, 2011, 15:28 (4510 days ago) @ woddrazen

Hi Drazen,

We are using Public Authentication but using Private Key. And, can you please explain how do we distribute the dlls?
What are the dependent files and assemblies for keymanager dll.

Below is our code:
[code]_sftp.Authentication = WeOnlyDo.Client.SFTP.Authentications.PublicKey;
_sftp.Encryption = WeOnlyDo.Client.SFTP.Encryptions.Auto;
_sftp.TransferMode = WeOnlyDo.Client.SFTP.TransferModes.Binary;
_sftp.Blocking = true;
_sftp.Resume = true;
Login = GetKeyValue( Login , Config, web);
_sftp.Login = Login;
Hostname = GetKeyValue( Hostname , Config, web);
_sftp.Hostname = Hostname;
Port = GetKeyValue( Port , Config, web);
_sftp.Port = Convert.ToInt32(Port);

// Set Private Key settings.
KeyFile = GetKeyValue( KeyFile , Config, web);
_KeyFile = KeyFile;
WeOnlyDo.Security.Cryptography.KeyManager keyManager = new WeOnlyDo.Security.Cryptography.KeyManager();
keyManager.Load(_KeyFile);
_sftp.PrivateKey = keyManager.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey);
[/code]


Regards,
Sid

Re: Could not load file or assembly

by woddrazen, Wednesday, November 23, 2011, 15:43 (4510 days ago) @ insrod

Sid,


There shouldn't be any dependency. You only need to distribute wodKeyManager.NET dll file.

However maybe installing Microsoft Visual C++ 2008 Redistributable Package will help:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=29


Drazen

Re: Could not load file or assembly

by insrod, Wednesday, November 23, 2011, 16:02 (4510 days ago) @ woddrazen

Hi Drazen,

You are not getting it probably.
I am asking how to distribute the KeyManager dll?

Here is the problem:
1) Create an application with reference to WeOnlyDo dll.
2) GAC has the dll from Application data which was referenced in the application.
3) Build and run application in the same server, it runs fine.
4) Move the same dll to a different server.
5) Copy the same KeyManager dll referenced in the application from Dev environment to Problematic environment. Error comes. (The located assembly's manifest definition does not match the assembly reference)
6) Use the KeyManager dll from the Problematic environment Application data, still error comes. (Could not load assembly)

Now, can you please respond.
It has been quite a burning issue here.

Regards,
Sid

Re: Could not load file or assembly

by insrod, Wednesday, November 23, 2011, 16:06 (4510 days ago) @ insrod

Hi Drazen,

We are using the dlls WeOnlyDo.Client.SFTP and WeOnlyDO.Security.Crytography.KeyManager in our application.

Re: Could not load file or assembly 'WeOnlyDo.S

by wodDamir, Wednesday, November 23, 2011, 16:14 (4510 days ago) @ insrod

Sid,

Please try setting the Copy Local property for each reference to True. You should basically be able to simply copy the debug/release folder to another machine and run the application.

However, if that doesn't work can you please try importing the KeyManager.Net into GAC?

Regards,
Damba

Re: Could not load file or assembly 'WeOnlyDo.S

by lugipfupf, Wednesday, February 29, 2012, 17:25 (4412 days ago) @ wodDamir

Hi there
Was this ever resolved? Because I am having the same problem here. It does work out of the box on my dev-machine (XP / 32bit / VisualStudion 2010 SP1).
However, I can't seem to get it to work on any of the servers we intend to use it on. There are three servers:
-dev Win2008 32bit
-test Win2008 64bit
-prod Win2008 64bit
I (re-)installed all the available VC++ Packages, well, at least most of them (3x 2005, 2x2008, 2x2010 versions).
CopyLocal is set to true.
Also tried to load the WeOnlyDo.Security.Cryptography.KeyManager.dll into GAC.
Nothing seems to work.

regards
Beat Luginbühl

Re: Could not load file or assembly 'WeOnlyDo.S

by wodDamir, Wednesday, February 29, 2012, 17:53 (4412 days ago) @ lugipfupf

Hi,

What type of project are you using KeyManager in? Can you try setting Target Platform to x86?

Regards,
Damba

Re: Could not load file or assembly 'WeOnlyDo.S

by lugipfupf, Thursday, March 01, 2012, 10:12 (4411 days ago) @ wodDamir

It's a console application that will get some files via sftp using key authentication and then process them. I have tried setting it to x86 as well as the other available options.

Any other ideas?

Re: Could not load file or assembly 'WeOnlyDo.S

by wodDamir, Thursday, March 01, 2012, 11:09 (4411 days ago) @ lugipfupf

Hi,

What Framework version are you targeting your application for?

Regards,
Damba

Re: Could not load file or assembly 'WeOnly

by lugipfupf, Thursday, March 01, 2012, 11:39 (4411 days ago) @ wodDamir

Right now, it's set to 3.5, since it is also using Linq.
This brings me to the idea of putting the sftp stuff into a separate project targeted for 2.0. I will try that this afternoon, although I would be surprised if this works.

hvala and regards
lugi

Re: Could not load file or assembly 'WeOnlyDo.S

by wodDamir, Thursday, March 01, 2012, 11:40 (4411 days ago) @ lugipfupf

Hi,

Can you please try targetting it to 2.0? Just for test?

If that shows to be right, we can provide a .dll build for 3.5.

Regards,
Damba

Re: Could not load file or assembly 'WeOnly

by lugipfupf, Thursday, March 01, 2012, 13:48 (4411 days ago) @ wodDamir

I'll do that, but will have move everything because of the Linq stuff (3.5+). I'll let you know the results.
In the meantime, it would be nice to have a 64bit version as well.

thx in advance,
lugi

Re: Could not load file or assembly 'WeOnlyDo.S

by wodDamir, Thursday, March 01, 2012, 14:01 (4411 days ago) @ lugipfupf

Hi,

You could try creating a small, new project with only KeyManager, just to try, instead of removing Linq from your existing project.

As for 64bit version, we do have it built too. We can provide it also, but let's first see how the above test turns out.

Regards,
Damba

Re: Could not load file or assembly 'WeOnly

by lugipfupf, Thursday, March 01, 2012, 14:33 (4411 days ago) @ wodDamir

ok, here's what I just did:
-moved everthing that would belong into separated library anyway, set it to .net 2.0 --> same error
-read your most recent post
-created a small .net 2.0 console app with just the following inside main():
[code]KeyManager km = new KeyManager();[/code]
--> still the same error:

Message: Could not load file or assembly 'WeOnlyDo.Security.Cryptography.KeyManager, Version=2.0.3.20, Culture=neutral, PublicKeyToken=900ddd6a51580424' or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)

Re: Could not load file or assembly 'WeOnlyDo.S

by wodDamir, Thursday, March 01, 2012, 15:21 (4411 days ago) @ lugipfupf

Hi,

Is there any chance you could send this project to us at techsupport@weonlydo.com?

Regards,
Damba

Re: Could not load file or assembly 'WeOnly

by lugipfupf, Thursday, March 01, 2012, 15:38 (4411 days ago) @ wodDamir

After checking with my bosses, I'm going to prepare the project, removing any sensitive data, mainly from app.config.
Expect an email with the attached project.

regards,
lugi