[英]How to run "dotnet myDll.dll" from a .net core project?
I have a .net core project on mac/linux, which I can run from the terminal using我在 mac/linux 上有一个 .net 核心项目,我可以使用它从终端运行
dotnet myDll.dll
I want to run this from my c# project code - so start up the webapp and then run ui tests against it.我想从我的 c# 项目代码运行它 - 所以启动 webapp 然后对其运行 ui 测试。
I have tried我试过了
var path = "path-to-my-dll/myDll.dll");
var processStartInfo = new ProcessStartInfo(path, "")
{
WorkingDirectory = Path.GetDirectoryName(path)
};
var process = Process.Start(processStartInfo);
However this just runs the terminal equivalent of然而,这只是运行终端相当于
./myDll.dll
How do I call the do.net command?如何调用 do.net 命令?
Thanks to huysentruitw and Execute do.net command with Process in C#感谢 huysentruitw 和Execute do.net command with Process in C#
var processStartInfo = new ProcessStartInfo(expected, "")
{
FileName = "dotnet",
Arguments = "myDll.dll",
WorkingDirectory = Path.GetDirectoryName(path)
};
You should be able to pass do.net
as a fileName
and myDll.dll
as the startup argument to the ProcessStartInfo
constructor , like this:您应该能够将
do.net
作为fileName
名和myDll.dll
作为启动参数传递给ProcessStartInfo
构造函数,如下所示:
var processStartInfo = new ProcessStartInfo("dotnet", "myDll.dll")
{
WorkingDirectory = Path.GetDirectoryName(path),
};
var process = Process.Start(processStartInfo);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.