build and publish .net Web App programmatically

2019-07-03 01:50发布

问题:

I'm building an application that needs to be able to, on a command, publish itself to a specified directory.

I'm looking for something like

System.BuildSystem.Build(<project file>, 'release');
System.BuildSystem.Publish(<project file>, <destination folder>);

Is this possible?

回答1:

Take a look at msbuild or nant. Personally, I use msbuild to push releases to our QA environment and create packages to be rolled out to production.

Your application could, for example, call batch files that run msbuild scripts to produce and publish builds.