Skip to main content

Posts

Showing posts from April, 2009

Building Native 64-bits Boost Library

I started using 64-bits Vista recently and I thought it made sense to make a native 64-bits build my favourite C++ library too. My first attempt was a complete failure because I naively thought all I have to do is to run the bjam in Visual Studio 64-bits Tools Command Prompt. It turned out this only builds a regular 32-bits Boost library. After some Googling and reading forum posts, I found some useful information in the Boost.Build document . Apparently, Boost does support building 64-bits target and what I end up doing is to specify the architecture and address-mode flags when running the bjam. c:\boost_1_38_0>bjam ^ More? --toolset=msvc ^ More? --build-type=complete ^ More? architecture=x86 address-model=64 ^ More? stage then I installed the library by c:\boost_1_38_0>bjam ^ More? --toolset=msvc ^ More? --build-type=complete ^ More? architecture=x86 address-model=64 ^ More? install

Installing the WTL Application Wizard in Visual C++ 2008 Express Edition

I love Google Chrome, it is fast, elegant and beautiful. After I realized that it was written using WTL, I felt quite keen to learn about this library. I downloaded WTL 8.0 from SourceForge.net and Visual C++ 2008 Express Edition from Microsoft.com only to realise that there is no WTL Wizard support for Visual C++ 2008 Express Edition. WTL 8.0 ships with WTL/ATL application wizard but the setup script only supports the Visual C++ 2005 Express Edition (setup80x.js). However, the good news is that you can make it work with Visual C++ 2008 Express Edition in few simple steps: Make a copy of the setup80x.js and rename it to setup90x.js. Open setup90x.js up and do a global search and replace from “8.0” to “9.0”. Save the file and execute it. If you are as lucky as I am, you should see a dialog that tells you that the wizard has been successfully installed. Now, when you run Visual C++ 2008 Express Edition and go File –> New –> Project… you should now see

Updating .config Files from Visual Studio Setup Project

To open Web.config from within a web setup project: string path = Context.Parameters["assemblypath"]; path = path.Substring(0, path.LastIndexOf( Path.DirectorySeparatorChar)); path = Path.Combine(path, "Web.config"); var config = ConfigurationManager.OpenExeConfiguration(path) To open App.config from within a setup project: var map = new ExeConfigurationFileMap(); map.ExeConfigFilename = Context.Parameters["assemblypath"] + ".config"; var config = ConfigurationManager.OpenMappedExeConfiguration( map, ConfigurationUserLevel.None); To update settings in .config files // update connection strings var cs = config.ConnectionStrings; cs.ConnectionStrings["cs1"].ConnectionString = BuildConnectionString(host, user, pass); // update app settings var appSettings = config.AppSettings; appSettings.Settings["key"].Value = "new value"; Finally, to save the .config file changes