我们可以通过编程方式调用MSBuild命令吗? [英] Can we call MSBuild command programmatically ?
本文介绍了我们可以通过编程方式调用MSBuild命令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以通过编程方式调用以下命令吗?
msbuild"MySolution.sln"/t:构建/p:Configuration = Debug/p:Platform =任何CPU"
或
ILDASM
谢谢
Can we call following command programmatically ?
msbuild "MySolution.sln" /t:Build /p:Configuration=Debug /p:Platform="Any CPU"
or
ILDASM
Thanks
推荐答案
谢谢您的提问.这是一个命令.您可以在代码中执行它.
波纹管链接将为您提供帮助.
http://www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx [ ^ ]
谢谢,
Mamun
Thank you for your question. This a command. You can execute it in code.
Bellow link will help you.
http://www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx[^]
Thanks,
Mamun
嗨Khaniya,
您可以尝试执行以下步骤.
1.使用命令创建一个批处理文件.
2.从代码运行批处理文件.
要运行批处理文件,请尝试此
Hi Khaniya,
You can try following steps.
1. create a batch file with command.
2. Run batch file from code.
To Run batch file try this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace VG
{
class VGe
{
[STAThread]
static void Main(string[] args)
{
Process proc = null;
try
{
string targetDir = string.Format(@"D:\adapters\setup");//this is where mybatch.bat lies
proc = new Process();
proc.StartInfo.WorkingDirectory = targetDir;
proc.StartInfo.FileName = "mybatch.bat";
proc.StartInfo.Arguments = string.Format("10");//this is argument
proc.StartInfo.CreateNoWindow = false;
proc.Start();
proc.WaitForExit();
}
catch (Exception ex)
{
Console.WriteLine("Exception Occurred :{0},{1}", ex.Message,ex.StackTrace.ToString());
}
}
}
}
,
,
这 [ ^ ]线程也可能有帮助.
This[^] thread may also help.
这篇关于我们可以通过编程方式调用MSBuild命令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文