简体   繁体   中英

How call .NET command prompt

How to call .NET command prompt from Aspx to Build/Publish another windows application.

I have a windows application, that I want to build via my web application (aspx). How can I do that?

You want to build from aspx? Odd, but... Ultimately you have Process.Start which can execute any command, but you should think very carefully about which security context / identity your web-server is running as, and where it can read / write files, and the impact of using a web-server as a build-server.

Another option is to use the web-server to queue the work (perhaps MSMQ etc), and have a separate service (on a separate machine) dequeuing and doing the build / publish.

You'll want to use the System.Diagnostics.Process object to spawn another task. You probably don't want a command prompt. Instead, you'll want to call MSBUILD.EXE directly and pass in a target of "Publish".

msbuild.exe /t:Publish MySolution.sln

这是执行命令的方式 ,您要执行的命令是MSBuild

Write a .bat file that calls csc.exe or msbuild or whatever with the appropriate parameters. Execute the bat with System.Diagnostics.Process.Start method. You may need to set appropriate permissions for the web application process

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM