Sometimes you may need to setup Continuous Integration server to build VS solutions without installing VisualStudio there. But MSBuild is not able to build all solution, you’ve created on your local machine.

The first error you can start getting will be something like:

The imported project ” C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WCF\ Microsoft.VisualStudio.ServiceModel.targets” was not found.

Solution is quite simple:

  • Copy targets from your local machine to MSBuild folder on CI server.

Unfortunately this doesn’t solve all problems. MSBuild will keep throwing exceptions. This time it will be about missing dll:

Could not load file or assembly ‘Microsoft.VisualStudio.ServiceModel.Core, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.

This time solution will require few more steps:

  • Find the missing dll on your local machine and copy it to the same location on your CI server. It can look like “c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Microsoft.VisualStudio.ServiceModel.dll”.
  • Install this dll into GAC: open “Developer Command Prompt for VS2013”, go into directory with dll and register it to the GAC using command “gacutil.exe -i Microsoft.VisualStudio.ServiceModel.Core.dll”

gac

When all these steps are done, MSBuild will be able to build your solution successfully.

Qt Installer Framework is a quite new framework which is currently still in development. The current version contains set of tools and utilities to create installers. The most significant feature is that the framework itself is multiplatform, it supports Windows, Mac OS X and Linux.

Great feature of QT Installer Framework is that it can download the required files from the server. That means it is not required to provide files with the installer. It works with the so called “repositories”. Thanks to this it is also able to update the files without having to download the installer again, because it creates maintenance tool which can update or uninstall the files. However the documentation is not perfect, it is missing a lot of details.

The framework is an open source project. It is built on top of the Qt (it requires static built of Qt).

The framework is really easy to use. For the basic features the user needs to know to work with XML, that is all. For advanced features the knowledge of javascript (QtScript) is required (C++ might be required for the most advanced features).

Usage

Whole installer creation process starts with creating the required folder structure.

Screen Shot 2015-01-28 at 09.16.11

There are two main folders. The config and the packages folder.

Configuration

The config folder contains the installer configuration file (config.xml) and images used in the installer. There are various things that can be configured – Supported Configuration Settings. This is the example what the configuration file could look like:

<?xml version="1.0" encoding="UTF-8"?>
<Installer>
 <Name>YSoft SafeQ Mac Client</Name>
 <Version>4.3.0</Version>
 <Title>YSoft SafeQ Mac Client Installer</Title>
 <Publisher>Y Soft</Publisher>
 <ProductUrl>http://www.ysoft.com</ProductUrl>
 <TargetDir>@HomeDir@/YSoft</TargetDir>
 <AllowSpaceInPath>true</AllowSpaceInPath>
 <InstallerApplicationIcon>ysoft_96</InstallerApplicationIcon>
 <InstallerWindowIcon>ysoft_96_32x32</InstallerWindowIcon>
 <Watermark>modern-wizard.bmp</Watermark>
 <WizardStyle>Aero</WizardStyle>
</Installer>

Packages

The second folder is the package folder. It contains all components that will be installed by the installer. Every component consists of two folders, the data and the meta folder.

The data folder contains all the files that will be installed on the target machine. Installer archives all data to the 7z format and extracts it on installation.

The meta folder contains configuration file(package.xml) for the component and the installation script that will be called when the component is loaded.

This is the example file of component configuration file

<?xml version="1.0" encoding="UTF-8"?>
<Package>
 <DisplayName>CUPS Backend</DisplayName>
 <Description>CUPS Backend</Description>
 <Version>4.3.0</Version>
 <ReleaseDate>2015-01-23</ReleaseDate>
 <Default>true</Default>
 <Script>installscript.js</Script>
 <ForcedInstallation>true</ForcedInstallation>
 <RequiresAdminRights>true</RequiresAdminRights>
</Package>

and here is the full list of possible configuration values – Summary of Package Information File Settings.

The next file is the installation script file (installscript.js). The script is called when the installer is executed and the component is loaded. The script can add new installer wizard pages, prompt user for custom path for the component etc. This is example of a script that extracts component to the /tmp folder and moves it to the Application. Then it adds new item (log out checkbox) to the final page of the installer (the page items or pages have to be designed in Qt designer).

function Component(){
	//Connect signals to functions
	component.loaded.connect(this, componentLoaded);
	installer.finishButtonClicked.connect(this, finishClicked);
}

Component.prototype.createOperationsForArchive = function(archive){
	//Extract and move .app file
	component.addOperation("Extract", archive, "/tmp");
	component.addElevatedOperation("Execute","mv", "/tmp/YSoft\ SafeQ\ Client.app", "/Applications", 
								   "UNDOEXECUTE", "rm", "-rf", "/Applications/YSoft\ SafeQ\ Client.app");
}

componentLoaded = function(){
	//If this is installer load checkbox from .ui file
	if(installer.isInstaller()){
		installer.addWizardPageItem(component, "LogOutCheckBoxForm", QInstaller.InstallationFinished);	
	}
}

finishClicked = function(){
	if(!component.installed)
		return;
	//If the installation was succesful, let the user log out
	if(installer.isInstaller() && installer.status == QInstaller.Success){
		var isLogOutChecked = component.userInterface("LogOutCheckBoxForm").LogOut.checked;
        if (isLogOutChecked) {
			//Todo - logout
		}
	}
}

Here is the documentation for the Component scripting.

The installer is created by executing the Qt Installer tool

binarycreator -c config/config.xml -p packages installer

where -p is path to the packages folder and -c is path to the config.xml file. The last part is the name of the installer. 

This is the look of the final installer on Mac OS X:

Screen Shot 2015-01-28 at 09.48.00

It’s quite easy to install Docker on Windows. Just download installer and follow instructions.

You might encounter following error message when starting Docker image: VT-X is not available.

hyperv-docker-vbox-problem

The cause of this failure is enabled Hyper-V Windows Feature. We described this issue in previous article.

Here is the quick fix.

Search for “windows feature” and open “Turn Windows features on or off
turn-off-windows-feature

Search for “Hyper-V” in Windows features and uncheck it.

hyper-v-disableClick OK and reboot the machine.

VirtualBox is able to host 64bit guest OS on Windows. That’s useful for testing various platforms.

The trouble begins when you turn on Hyper-V Windows Feature. It might happen by installing some software or update. When Hyper-V is enabled then it’s not possible to create new guests with 64bit OS and it’s not possible to boot anything with 64bit kernel created before this feature was turned on.

In order to make 64bit guests working again you’ll need to turn off Hyper-V feature.

Search for “windows feature” and open “Turn Windows features on or off
turn-off-windows-feature

Search for “Hyper-V” in Windows features and uncheck it.

hyper-v-disableClick OK and reboot the machine. 64bit OS guests start working again.

Virtual environment is essential component of Python world. You can isolate different version of packages into separate environments.

How to set up virtualenv?

Install Python and virtualenv package by pip:

pip install virtualenv

python-insltall-virtualenv

Create directory which will hold the virtual environment (e.g. pyenv34) and initialize it:

virtualenv --system-site-packages pyenv34

python-setup-virtualenv

You can uses system-site-packages option to tell virtualenv to inherit system packages from system installation of Python.

The next step is to activate environment:

.\pyenv34\Scripts\activate.ps1

pyenv-activate

Your command prompt will change and you will see the name of virtual environment in the command line.

Now you can install, uninstall packages by pip and everything will be isolated in the virtual environment directory.

E.g. install ipython

virtual-env-use

It’s time to import antigravity 🙂

pyenv-antigravity

Sometimes it is necessary to work only with text console.

Git provides rich command line interface, but browsing history is little bit cumbersome.

If you like command line tools and email client mutt then there is awesome tool for you: tig.

tig is text mode interface for git.

Just enter directory with cloned git repo and type:

tig

tig-example

Quick navigation:

  • Enter – show details
  • Tab – switch window pane
  • q – quit

You can find more information at http://jonas.nitro.dk/tig/manual.html.

This tool is available for Mac and Linux. Windows version is available in Cygwin.