We purchased a custom-modified C#/Silverlight 5 application from a third party. This program was designed to allow processing of maintenance work orders on remote Windows 8 Pro machines when in either a connected (WiFi or 3G) or disconnected state. Silverlight application storage is used to store all of the work order, parts, history, comments, and labor data downloaded from the mobile server.
The source code for the application is stored in a GIT repository on Bitbucket.org, so modifications can be made by either the third party or our programmers. With the explosive growth of software development in the Cloud, this is becoming an increasingly common situation. With the increased use of Agile programming techniques, new versions or releases are delivered more frequently as well. Add to that the complexity of deploying the software on a regular basis to a variety of hardware and software platforms necessitated by the increased use of mobile devices.
Because of all of the above, the IT department is frequently required to deploy new and updated software, which in this case proved to be a difficult and uneven process. We eventually got it to work properly through several months of trial and error. By following the techniques in this article others may avoid the costly mistakes and problems we encountered. Cheers.
The software modification and deployment process is as follows:
1. Verified (tested and approved on a local machine) code changes are committed and pushed to the Bitbucket repository.
2. The current master codebase is pulled from the Bitbucket GIT repository to the local repository on a virtual machine with a custom development environment. We are using the free SourceTree software from Atlassian to process the codebase.
3. A build is created using the “deploy.msbuild” xml script provided by the vendor, embedded in a custom script (“prod.bat” for production) which includes these steps:
a. Turn off the background windows service on the server to avoid file locking.
b. Create the build: “C:\Windows\Microsoft.NET\
\msbuild deploy.msbuild /p:Configuration=Productio
c. Move the resulting zip file to the server
d. Create a temporary directory to hold the uncompressed files from the zip file.
e. Expand the zip file into the temporary directory.
f. Copy and replace the original directory with the contents of the temporary directory.
g. Remove the temporary directory.
h. Restart the background Windows service.
i. Move the build zip file to the archive, renaming by appending current date and time.
4. On each mobile client device (this process needs to be automated – it is extremely tedious and time-consuming):
a. Uninstall the application through the control panel, which completes the following steps (actual file name replaced by “999999999”):
i. Deletes the application from C:\Users\\AppData\Local\Mi
ii. Deletes the shortcut from the desktop
iii. Removes the key from the registry at HKEY_CURRENT_USER\Software
b. Delete the Silverlight isolated storage (C:\Users\\AppData\LocalLo
i. start the Silverlight Configuration application
ii. select the Application Storage tab
iii. select the specific app’s web site and click the “Delete…” button or click the “Delete all…” button.
iv. Click the “OK” button.
c. Clear the Internet Explorer (IE) browser cache – if you don’t do this, the previous version of the app will continue to run until the cache expires. This seems illogical if the program runs “out of browser”, but is true none-the-less based on my experience. I kept rebuilding over and over because the new version refused to deploy until I finally discovered, with the help of others, the “204” lines in the Fiddler debug tool, indicating that the cached version of several of the files were being loaded when the program was started. I found that I needed to UN-CHECK “Preserve Favorites website data” and CHECK “Temporary Internet files and website files” in order to get the newest version to run. On IE 10, go to “Tools” or the gear icon, “Internet Options”, click the “Delete…” button under “Browsing history” on the “General” tab. UN-CHECK and CHECK the respective boxes detailed above, then click the “Delete” button. Wait awhile for the process to finish before proceeding.
5. Install the program on each client device:
a. I deployed the Silverlight application using the “Publish” option in Visual Studio and used an HTTP link as the method of installation, so the program can be installed on the mobile device by clicking a link or typing the
http:// string into the address bar of IE.
b. Click on the “Yes” button of the ensuing page, then the “Install” button on the Security Warning window if necessary.
c. The program will install and run.
Prod.bat requires 7zip (replace bracketed(<>) names with actual ones):
sc \\ stop
sc \\ queryex
msbuild deploy.msbuild /p:Configuration=Productio
move /Y c:\tmp\publish\*.zip \\\E$\\
cd \Program Files\7-Zip\
7z x -y -o\\\E$\\Temp \\\E$\CGPlatform\*.zip
xcopy \\\e$\\Temp\*.* e:\CGPlatform\*.* /S/Y/F/H/R
rmdir \\\e$\\Temp /S/Q
sc \\ start
sc \\ queryex
move /Y \\\e$\\*.zip \\\e$\\Archive\%date:~-4,4