Linux调用另外两个c,在linux中从另一个c可执行文件中运行c可执行文件时出现System.ComponentModel.Win32Exception...

我正在尝试以下操作:

1) 从另一个可执行文件运行c#可执行文件。

我正在使用.net Core3.1

Error =>No such file or directory

Exception encountered => System.ComponentModel.Win32Exception (2): No such file or directory

at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean

redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean

setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32&

stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal,

Boolean throwOnNoExec)

at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)

at System.Diagnostics.Process.Start()

at ConsoleMQTT_Sender.ProcessClass.LaunchProcess(....) in ...

该应用程序是通过运行在linux环境中的jenkins生成的。

这是跨平台问题吗?

还是许可问题?

dotnet firstexecutable.dll--secondexecutablepath“/opt/publish/xyz.dll”

dotnet firstexecutable.dll--secondexecutablepath“dotnet/opt/publish/xyz.dll”

两者都有相同的例外

process.EnableRaisingEvents = true;

process.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(process_OutputDataReceived);

process.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(process_ErrorDataReceived);

process.StartInfo.FileName = firstexecutablepath;

process.StartInfo.Arguments = "--secondexecutablepath \"" + executablepath + "\"";

process.StartInfo.RedirectStandardError = true;

process.StartInfo.RedirectStandardOutput = true;

process.Start();

process.WaitForExit();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值