Search AppDomain.Current.BaseDirectory for WinSCP.exe
When publishing a .NET app as a single file (
The fix is to add
This is a request to automatically search
P.S. A semi-related issue, setting
<PublishSingleFile>true</PublishSingleFile>
), WinSCP.exe is not found even if it sits beside the published exe:
WinSCP.SessionLocalException: The winscp.exe executable was not found at location of the assembly WinSCPnet (), nor the entry assembly Memphis (), nor in an installation path. You may use Session.ExecutablePath property to explicitly set path to winscp.exe. at WinSCP.ExeSessionProcess.FindExecutable(Session session) at WinSCP.Session.GetExecutablePath() at WinSCP.Session.get_ExecutablePath() at WinSCP.ExeSessionProcess.GetExecutablePath() at WinSCP.ExeSessionProcess..ctor(Session session, Boolean useXmlLog, String additionalArguments) at WinSCP.ExeSessionProcess.CreateForSession(Session session) at WinSCP.Session.Open(SessionOptions sessionOptions)
This is a request to automatically search
AppDomain.CurrentDomain.BaseDirectory
(or AppContext.BaseDirectory
, but that is not available on net40).
P.S. A semi-related issue, setting
session.DebugLogPath
results in an error:
System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle. at System.Reflection.RuntimeAssembly.get_CodeBase() at WinSCP.Logger.WriteEnvironmentInfo() at WinSCP.Logger.SetLogPath(String value) at WinSCP.Logger.set_LogPath(String value) at WinSCP.Session.set_DebugLogPath(String value)