Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stand-alone build system for Visual Studio projects

We use Make to compile our product, which includes, C, C++, Java and a bunch of other bits and pieces. As much as possible we have all tools required to compile the whole thing checked into source control, to eliminate local dependencies and to ensure consistency across dev machines.

Recently we've added some components written in C# using Visual Studio and would like to take a similar approach with Visual Studio solutions. Shelling out to devenv isn't a good option. Calling csc.exe directly (as I've done before using Nant) would require keeping track of file dependencies in the build script, which I'd rather just let the Visual Studio solution do.

MSBuild seems like a good bet, though its default location in %windir%\Microsoft.NET\Framework\[version]\ makes me worried about variability between machines, both with the [version] in the path and the fact that you'll see both "Framework" and "Framework64" directories. I wouldn't mind having a requirement that all developers have whatever .NET framework version installed, but I do worry that your v3.5 might not be the same as mine.

Does anyone have a solution to this that they like? Tried anything that you really didn't like?

like image 876
Eric McNeill Avatar asked Oct 26 '09 22:10

Eric McNeill


People also ask

What build system does Visual Studio use?

Visual Studio will use heuristics to build the files. This is an easy way to compile and run small console applications.

How do I compile a Visual Studio project?

To build only the selected Visual C++ projectChoose a C++ project, and then, on the menu bar, choose Build > Project Only, and one of the following commands: Build Only ProjectName. Rebuild Only ProjectName.


2 Answers

MSBuild is the lowest-friction option for sure. Different fx versions aren't that big a deal at build-time- if you're using something important from a fx version higher than what's installed, it won't build. The last place I was at, we built a huge multi-environment build system with NAnt as the base, and it hooked out to MSBuild with NAnt's MSBuild tasks. MSBuild is fine on its own if you're just doing MS stuff, but we had a bunch of things that MSBuild didn't natively support, hence the NAnt wrapper.

like image 73
nitzmahone Avatar answered Sep 26 '22 23:09

nitzmahone


I agree with everyone else. To make it easy, just make vsvars.bat (the batch file that is the Visual Studio Command prompt) part of your build script, and then MSBuild will just work.

like image 40
Jim Deville Avatar answered Sep 25 '22 23:09

Jim Deville