Nov 6, 2010

MSI wrapper for any installer using Wix

Last time we make windows installer package using MakeMsi compiler. Now we will make same using Wix. Wix is XML based setup compiler for Windows Installer format.
We will make simpliest as possible setup package wrapping existing installer, InnoSetup for example.
First we need make directory tree, required element is TARGETDIR Directory
<Directory Id='TARGETDIR' Name='SourceDir'>
Inside we will describe temporary folder for wrapped package
<!-- temp folder -->
<Directory Id='TempFolder'>
   <Component Id='my_setup' 
        <File Id="mysetup_exe" Source="mysetup.exe" /> 

Nov 5, 2010

Make MSI from InnoSetup installer

Last time my company customers ask for installer in Windows Installer MSI format. Company product is complex system, containing thousands of files and plenty of tasks. It cannot be quickly ported to other installer system. But result need to be ASAP.

Windows installer is complex product too, and even Microsoft itself make open source XML based project Wix to simplify tasks. Other good project is MakeMsi, used simply text files to describe tasks.

Sep 22, 2010

Add Syntax Highlighting Control


How to choose free, easy to use, extendable and good quality syntax highlighting control for .NET program?


First, what i have try to use, was ScintillaNet, but i have no luck to get it worked in test program. It need to setup before use, require unmanaged companion library, what make difficult to multiplatform use. After all i see my Visual Studio C# 2010 Express very unstable, after adding ScintillaNet control to Toolbox. After many experiments i get it worked, but result seems unstable and unrepeatable. Personally i not recommend to use Scintilla in .NET application, but possible it good choice for C++ project.


After searching i found editor control from a well known open source IDE SharpDevelop. Syntax Highlighting Text Editor Control looks very good and light after Scintilla. It requires less time to load and seems much more stable.

Sep 4, 2010

Check And Upgrade Existing Database

How to change database schema, adding or deleting field or table, to be sure of new version of application will work correctly and existing users not lose their data?

You working on application and have customers. One wonderful day customer ask you for new functionality. But you see it need to change database scheme. You made local changes, but many customers have old database. How to upgrade existing database, not harming to customers data. Make migration script and copy data from old database to new one? Not so good way.

What about programmatically change database schema on fly? For example you have table 'customers' and need to add field 'mob_phone'; You can use SQL statement to add field, only need to care if database schema already up to date.

Sep 2, 2010

Enumerate Embedded Resource Names

How to know and enumerate names of all resources, embedded into assembly?

Well, we know how to load embedded font to memory from resources, but... stream, returned from GetManifestResourceStream is always null??

Ok, you have to be sure about resource name. In general resource name consists from {assembly namespace}.{folder}.{file name}. If your resource not in folder at solution space than it simply {assembly namespace}.{file name}. And at last property of file should be "Embedded Resource".

Sep 1, 2010

Embedding Font To Resources

How to load and use custom font, embedded in assembly resources.

We leared how to load font not installed in system. But what about embedding font into assembly resources? We will use PrivateFontCollection as in previous example private font loading. But we'll need little bit more action.

First we add font file into project. Place it in root folder of project. Go to property and choose action Embedded Resource for font file.

Next add code to read font from resource.

Aug 31, 2010

Load And Use Custom Font Without Installing

How to load and use font, not installed in the system? Not always your application have enough rights to install custom font into system. For example in ClickOnce application.

RTFM? Bull Shit! When you need some functionality and look documentation anything looks so fine... before you start coding.

I wrote application for ClickOnce install. My application require custom font. How to use custom font whithout administrator privileges? I look MSDN documentation, find class PrivateFontCollection and see beautiful example. Three seconds and i have few lines code in my app. But nothing happens. Custom font doesn't appears!

Ok, i write test programm, and use complete example from MSDN. Same result! Looking example i see used font names - Arial, Courier New, Times New Roman... Why i not surprised this example works? Cause these fonts are preinstalled in system. Only complete idiot will delete these fonts!