C# publishing an .exe and sending params to it using cmd(C# 发布 .exe 并使用 cmd 向其发送参数)
问题描述
我很确定这是基本的,但我只是没有成功做到这一点我正在尝试创建一个控制台应用程序,它可以通过获取少量参数来执行 ABC
i am pretty sure this is basic but i just dont success to do this i am trying to create a console application that would do ABC by getting few arguments
首先,我正在尝试运行这么简单的东西
for start i am trying to run something as simple as that
static void Main(string[] args)
{
foreach (var s in args)
{
Console.WriteLine(s);
}
Console.ReadLine();
}
当我发布它时,它是一个clickonce"项目像 NAME.application 而不是 NAME.exe
when i publish it it comes at as a 'clickonce' project like NAME.application instead of NAME.exe
另外,当我尝试使用 XYZ 参数执行它时,就像在命令行中的同一文件夹中尝试一样
also , when i am trying to go execute it with XYZ parms like trying in same folder in command line
NAME.application agr1 agr2 agr3
它只是用空控制台打开应用程序:(
it just opens the application with empty console :(
推荐答案
.application 文件不是您的可执行文件,而是用于部署的文件.所以在本地运行程序时,还是应该运行.exe.文件.在此处查看有关命令行参数和 ClickOnce 的一些信息:在 Click Once 应用程序中模拟命令行参数"
The .application file is not your executable file, but a file used for the deployment. So when running the program locally, you should still run the .exe. file. Check here for some info about command line arguments and ClickOnce: "Simulating command line parameters in Click Once applications"
这篇关于C# 发布 .exe 并使用 cmd 向其发送参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C# 发布 .exe 并使用 cmd 向其发送参数
基础教程推荐
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
