Creating C # solutions from the command line using Visual Studio 2010

I want to automate the build process for my C # solutions. How can I create C # solutions from the command line so that I don’t have to deal with dependencies manually?

+62
c # build-process build-automation visual-studio build
Oct 08 2018-10-10
source share
6 answers

if you open the command line of the visual studio in your start menu - then you can call MSBuild and provide this .sln file or a specific .csproj file to create what you need

alternatively, you can create your own MSBuild file that will perform the tasks.

one tip: make sure that the version of MSBuild you are using is applicable to the target structure or version of the project tools

i.e. if you try to build a solution created in vs2010 using msbuild 3.5, then it will not recognize the project toolkit 4.0

+38
Oct 08 2018-10-10
source share

For solutions you can use:

devenv /build Release Solution.sln

or

devenv /build Debug Solution.sln

+66
Oct 08 2018-10-10
source share

Project projects and Visual Studio solutions also have MSBuild build files.

You can simply run MSBuild against the solution / project file, and it will build:

 <path to>msbuild.exe <path to>solution/project file 
+22
Oct 08 2018-10-10
source share

msbuild YourSolution.sln

+17
Oct 08 '10 at 15:35
source share

Personally, I am a big fan of Rake (yes, I heard when you said your C # solution)

Check this out: http://www.lostechies.com/blogs/derickbailey/archive/2009/09/23/albacore-a-suite-of-rake-build-tasks-for-net-solutions.aspx

Good luck - it made life a lot better for me!

+1
Oct 08 2018-10-10
source share

you can directly use the C # compiler ( csc.exe ):

Command line with csc.exe

+1
Oct 08 2018-10-10
source share



All Articles