gilesrpa
gilesrpa

Reputation: 1061

The application requires that assembly WinSCP Version 1.0.6.3261 be installed in the Global Assembly Cache (GAC) first

I have started to use WinSCP .NET assembly within my apps to enable SFTP transfers. All is well and the code works very well.

My issue comes from deployment.

Firstly, I installed WinSCP via NuGet package manager (version 5.7).

As stated, the code I have works great, connects to my SFTP server fine, transfers, renames and deletes files great.

But....

When I publish the application I get the following error message:

Unable to install or run the application. The application requires that assembly WinSCP Version 1.0.6.3261 be installed in the Global Assembly Cache (GAC) first.

Funny thing is, that the version of WinSCPnet.dllinstalled from NuGet is 1.2.6.5125.

I am using VS 2013 Ultimate, and using the built in publishing wizard.

Looking around the net, I found articles saying that WinSCPnet.dll needs to be in the GAC, so my first action was to manually add the installed version of WinSCPnet.dll (version 1.2.6.5125) into the GAC on the destination machine using gacutil /I winscpnet.dll, which did succeed as it is visible in the Windows\assembly folder, but the same error message appears on the destination machine after trying to reinstall the application.

It is a shame, as unless I can get this sorted, I will have to stop using this product and try something else.

Upvotes: 0

Views: 1446

Answers (2)

gilesrpa
gilesrpa

Reputation: 1061

After contacting WinSCP support, it happens that the issue was with the setup.

The following needs to be checked before publishing the app.

In Project properties, go to Publish page, click Application Files and make sure that Publish Status is set to Include for WinSCPnet.dll

Upvotes: 0

Martin Prikryl
Martin Prikryl

Reputation: 202232

It looks like you are publishing your application with a different version of the assembly, than you have built the application against.

The WinSCP .NET assembly version 1.0.6.3261 comes with WinSCP 5.1.5.

I suggest you remove all references to WinSCP from your project, delete all copies of the assembly, and reinstall the assembly from NuGet.

Then make sure that:

  • In Solution Explorer, the Copy Local property is set to True for WinSCPnet.dll
  • In Project properties, go to Publish page, click Application Files and make sure that Publish Status is set to Include for WinSCPnet.dll

(though these should be defaults, when installing the assembly from NuGet)

Upvotes: 1

Related Questions