I use NANT to automate the build process, now I face a little problem with silverlight. When you reference a service the designer of visual studio generate a ServiceReferences.ClientConfig with configuration of the service, it contains the address of the service and it gets compiled inside the.xap file generated by compilation
I use to point to a localhost machine during debugging, but in the real environment the service maybe is in another machine, so I need to find a way to point the client to the right service inside a nant build file. Since.xap files are nothing but a zip file I try to setup an action to unzip file, modify the ServiceReferences.ClientConfig, zip the file again and the game is done….exept that this does not works. It seems that Nant task <unzip> generates error when It tries to uncompress the xap file.
The solution was simple, I included 7z.exe (7-zip) on the buildTools directory, and simply instruct nant to uncompress with 7z.
This is a very simple approach. I set 7z.exe in the build folder so it gets downloaded when subversion update the project directory, then I set a variable called sevenzip that points to the executable. Then uncompress the xap file, copy the production configuration from the configuration folder, overwriting the old one, then zipping all again.
This operation has a double advantage, because I can zip the xap file with higher compression rate to make it smaller.