I use cygwin extensively and hate switching over to Visual Studio Command Prompt just to be able to use msbuild. I figured out how I can invoke msbuild from cygwin. It’s a neat and easy solution, but I am sure a better solution exists.
Steps to follow:
1. Create a file called vs [See Note 1]
2. Copy and paste the following line in the file:
cmd /k “C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat” x86
3. Save the file under /usr/bin. [See Note 2]
4. Make sure the file is executable. Execute the command
chmod +x vs
You are done.
Test it:
1. Open up cygwin and execute the file.
cygwin> vs
It will display this message and give you a VS command prompt:
Setting environment for using Microsoft Visual Studio 2005 x86 tools
Note 1: You can use a different name for the file. I named it vs for visual studio.
Note 2: You can put it under any directory you like. If you decide to put it under any other directory, then you you have two options:
1. Add that directory to PATH. OR
2. Give the full path to the directory whenever you execute this file.
Note 3: For some reason the UP key does not work. I need to find a fix for this.
Note 4: I know a better solution exists. The batch file which I execute in the vs file is setting a few environment variables. Instead of invoking this batch file, I should set the environment variables directly. This is a neater solution.