VSLinux bricklet documentation
Clone this wiki locally
Table of Contents
VSLinux is a solution for Linux code developers that prefer to use Microsoft Visual Studio as code editor. VSLinux provides means to generate Visual Studio project for arbitrary source code tree, initiate builds on remote Linux machines and analyze compilation errors produced by remote system exactly as if it was local build with Microsoft compiler.
The VSLinux bricklet isn't intended to replace the existing Linux development tools which are good and mature enough we believe.
It's rather a way to allow Windows developers to feel comfortable while making a transition to Linux world.
The "VS for Linux" bricklet should help people used to Visual Studio (or using it due to some environment limitations) to start developing for Linux with no pain.
- Developers/companies used to develop on Windows making transition/porting to Linux
- Developers/companies used to/want to use extended VS IDE abilities (Visual Assist and the like)
- Developers/companies working simultaneously on Windows and Linux projects or projects consist of both Linux and Windows parts.
Also, other IDEs implements the same "build-on-remote" functionality developers need and use. For example, Eclipse has the Remote System Explorer plugin does exactly the same. So we don't invent a wheel. Rather, we just bring the same functionality to another common IDE - MS Visual Studio.
Another use case is Linux code browsing and learning. Imagine, you're developing for the Windows but have to learn the code of a Linux project. Indeed, you have the LXR allowing you to browse through the source of vanilla Linux kernel. But what if you have to work with a customized kernel? BusyBox? Host APD? etc.
It becomes easy with the "VS for Linux" bricklet. Just download/clone/checkout the code to either Windows or Linux, create a project using our batch or makefile - voila! Now you just open the generated project with MS Visual Studio and browse the sources.
- VSLinux bricklet is a solution for those who want to write and build Linux code using Microsoft Visual Studio
- VSLinux provides seamless integration of Visual Studio with remote Linux build server
- Integration allows to use all Visual Studio editing features, standard build and error lists navigation tools
- VSLinux does not contain Visual Studio plugins or extensions thus it may be used with any Visual Studio edition including free Express editions
- VSLinux is not tied to some specific programming language or build system and may be used in variety of scenarios
- VSLinux components integrated once into project and committed/pushed to repository, recent Visual Studio project created with one command on each clone/checkout
- Development setup consists of two nodes:
- Development computer with Windows and Visual Studio installed
- Build computer with Linux installed
- Source tree resides on Linux machine and is exposed to the Windows Machine by the means of Samba server
- User runs VSLinux script (either locally on Windows machine or remotely on Linux machine via SSH) to generate Visual Studio Project file
- User opens generated project file in Visual Studio, project contains all source code files needed, all Visual Studio code editing features may be used exactly as if it was project generated by one of Visual Studio wizards
- Generated project file also contains custom build steps so when build initiated special VSLinux script runs on Windows Machine
- Windows script uses SSH to invoke its counterpart on Linux machine
- Linux script initiates project compilation, filters output and transforms it into format understood by Visual Studio
- Compilation output travels back to Visual Studio via Windows script and being parsed by standard error navigation tools
- Script and data templates to create Visual Studio project file for arbitrary source tree
- Scripts that initiate build on remote Linux server and transform Linux compiler output into format understood by Visual Studio
- Install Perl interpreter on your Windows machine (tested with ActivePerl: http://www.activestate.com/activeperl)
- Install PuTTY package (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) on your Windows machine
- Put Plink to %WINDIR% (or some other folder in %PATH%)
- Install and configure sshd server
- Install and configure samba server
- Connect once to your Linux machine using Plink/PuTTY with the SSH protocol to add it to list of known hosts (issue from Windows command line (cmd): plink [you_build_server_addr_or_name])
- Generate and import SSH key:
- On your Linux machine:
- change into the ~/.ssh directory (you may have to create this folder if it does not exist, verify that access mask for this folder in 700, i.e. run chmod 700 ~/.ssh)
- open the file ~/.ssh/authorized_keys with your favorite editor (you may have to create this file if this is the first key you have put in it).
- On your Windows machine:
- Launch PuTTYgen application
- Generate a SSH-2 RSA key with no key passphrase
- Add the content of PuTTYgen's "Public key for pasting into authorized_keys file" field to the ~/.ssh/authorized_keys file on build server.
- Verify that access mask for authorized_keys file is 400 (i.e. run chmod 400 ~/.ssh/authorized_keys).
- Save the private key to the file by pressing the "Save private key" data - let's say [your_path]\[your_key].ppk. Answer "Yes" to approve saving the key with no passphrase.
- On your Linux machine:
- Make your home folder (or other folder that will hold all the source code) accessible via Samba
- Define and export VSLINUX_MAP_ROOT environment variable in .bashrc (or similar) file and set it to absolute path of folder that will be mapped as network drive on Windows (~ in most cases)
- Map your home folder (or other folder that will hold all the source code) on Linux build server as network drive
- Define VSLINUX_SSH_KEY environment variable and set it to [your_path]\[your_key].ppk
- Define the VSLINUX_SSH_USER environment variable and set it to your Linux build server username (if it differs from Windows one only, case does matters).
- Put bricklet folder VSLinux to project source tree root
- Edit file VSLinux/dnx_list_files.cfg to define which files have to appear in Visual Studio project
- See comments inside the file for full file syntax description
- Optionally customize set of Visual Studio build configurations being generated
- See file VSLinux/dnx_list_files.buildcfg for description of build configuration definition syntax
- Run make -f VSLinux/Makefile.template vcxproj on Linux or VSLinux/_make_vcxproj.bat on Windows to create Visual Studio project file
- Re-run project creation command each time you added files to source tree or just make a clean repository clone
- Enjoy VSLinux!
- Create Visual Studio wizard that will perform integration and project creation automatically
- Visual Studio does not see target system includes