Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

AlanBell68

Re: Installing WinSCPnet.dll to GAC using PowerShell script on Windows 7 PC

I was able to test this approach yesterday, and this seems to have done the trick.

This is probably going to be a much more flexible solution going forward, so thank you for suggesting this.

Thanks you very much for your help!

Regards,

Alan
AlanBell68

Re: Installing WinSCPnet.dll to GAC using Powershell Script on Windows 7 PC

I didn't have GACUtil installed initially, so went ahead and downloaded it. When I attempted to install it, I got an error saying that my .net framework (4.0) version was an out of date version, and that I needed to update it.

I then went out to grab the latest .net 4.0 framework version to install it, and it said that the .net 4.0 version installed was later than the version I was trying to install.

I'm really tearing my hair out with this one.

Thanks & regards,

Alan
martin

Re: Installing WinSCPnet.dll to GAC using Powershell Script on Windows 7 PC

Sorry, it works for me. It's hard to guess what's wrong/different on your side. Did you try using gacutil instead?
AlanBell68

Installing WinSCPnet.dll to GAC using Powershell Script on Windows 7 PC

Thanks for your response. I have been launching the Powershell ISE as administrator, and running from there, but unfortunately this hasn't helped. If I go back to the older version of the DLL, I can re-install without an issue, so it would seem that the issue stems from the newer DLL, a new prerequisite (specific .net version perhaps?) or something else I am failing to grasp.

Thanks again for your help.
AlanBell68

Installing WinSCPnet.dll to GAC using PowerShell script on Windows 7 PC

For the purpose of backward compatibility with some older applications, I have a Windows 7 environment that is used to maintain and support these applications.

We call WinSCPnet from within a SQL Server Integration Services package, created with SQL Server Data Tools 2010, for deployment on a SQL Server 2012 Server.

We have a new requirement that involves cycling through a list of files that are spread across multiple sub-folders, and upload them to the same folder structure on a SFTP server. As a result, I have downloaded a newer version of the WinSCP automation package (version 5.17.10), which includes the WinSCP executable and the WinSCPnet DLL. This will allow us to take advantage of the additional functionality offered by the RemotePath class. This class is referenced in another C# code sample on this site that happens to meets our new requirements.

Previously, we had been using a version of WinSCPnet.dll (Product Version 5.7.7 per the file info), which I had been able to successfully register to the Global Assembly Cache using the PowerShell script below, copied elsewhere from this site:
Add-Type -AssemblyName "System.EnterpriseServices"
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("C:\WinSCP\WinSCPnet.dll")
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Having uninstalled the previously installed version of WinSCPnet from the Global Assembly Cache, Attempts to run the above PowerShell script to install the new WinSCPnet version fail.

The script does not return any errors, but WinSCPnet does not show up in the Global Assembly Cache, and the existing script does not work as a result.

I can copy the old version back into the same folder and re-run the script, and that installs the old version back, but not the new version.

I have installed .NET Framework 4.0.30319.01 on the Windows 7 machine, but unsure if I need a later Windows 7 friendly version.

I have also tried to copy in turn the WinSCPnet.dll versions from the net40 and netstandard2.0 folder of the installation files into the same folder as the WinSCP Executable and script, but still no luck.

Any assistance you can give would be appreciated.

Thanks in advance.