Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run ASP.NET MVC app using MSBuild command line

How do I compile and run an ASP.NET MVC app using nothing other than the MSBuild command line? My Visual Studio is super slow and I just want to be able to run an app quickly for bugfixes and showcasing etc. Is this possible? What's the command line for it?

like image 646
TechnicalTophat Avatar asked May 03 '16 11:05

TechnicalTophat


People also ask

How use MSBuild command line?

Use MSBuild at a command prompt To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

How do I publish with MSBuild?

You can pass /p:PublishUrl="newpath" to the msbuild command. You would also see this set in the csproj file which you can change. Hope this helps.

What is MSBuild command?

The build command is used to build an image from a Dockerfile, but the command has to be run in the same directory as the Dockerfile. When an image is built, the commands specified in the Dockerfile are executed. The operating system is installed​ along with all the packages required in the Docker container.


1 Answers

MSBuild is for building your application. If you want to run your app outside of Visual Studio, you need a web server for it. I'd recommend you to publish your app on local IIS. Just point your IIS website to your Web project folder. After that you will be able to access your application from the browser without running it from Visual Studio.

You can build your project from command line. Use msbuild.exe utility for it:

msbuild.exe projectname

You can find it in one of your .NET Framework folders (I recommend you to use the latest one):

C:\Windows\Microsoft.Net\Framework\v2.0.50727\MSBuild.exe
C:\Windows\Microsoft.Net\Framework\v3.5\MSBuild.exe
C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe
C:\Windows\Microsoft.Net\Framework64\v2.0.50727\MSBuild.exe
C:\Windows\Microsoft.Net\Framework64\v3.5\MSBuild.exe
C:\Windows\Microsoft.Net\Framework64\v4.0.30319\MSBuild.exe

When IIS is set up, you can build your app and see changes in your browser. Visual Studio is not necessary at this point.


Instead of IIS you can use IIS Express. Here is an article of how to run application on IIS Express from command line.

like image 188
Andrei Avatar answered Sep 28 '22 19:09

Andrei