Often I think MSI is overkill when all i need to do, is copy some files to a production server.
So how to set up TFS Build Server to Create a exe from a zip file. (Note I use the http://msbuildtasks.tigris.org/ to create the initial zip file).
I found the free http://www.disoriented.com/FreeExtractor/ , you need to download the optional command line version.
(Note I have a Tools folder at the root of my solution)
At the top of the TFSBuild.proj add the following:
<UsingTask TaskName="MSBuild.Community.Tasks.Zip" AssemblyFile="$(SolutionRoot)\Tools\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll" />
Afterwards the folder can be zipped:
<CreateItem Include="$(DropLocation)\$(BuildNumber)\Release\**" > <Output ItemName="ZipFiles" TaskParameter="Include"/> </CreateItem> <Zip ZipFileName="$(DropLocation)\$(BuildNumber)\deployment.zip" WorkingDirectory="$(DropLocation)\$(BuildNumber)" Files="@(ZipFiles)" />
And then use exec to call the MakeSFX:
<Exec Command="$(SolutionRoot)\Tools\FreeExtractor\MakeSFX.exe /nogui /zip=%22$(DropLocation)\$(BuildNumber)\deployment.zip%22 /sfx=%22$(DropLocation)\$(BuildNumber)\deployment.exe%22 /defaultpath=%22%24curdir%24%22 /exec=%22Deployment\AutoDeploy.bat%22 /autoextract /delete" IgnoreExitCode="true" />
All you need to do is make make a bat file called AutoDeploy.bat, and do the xcopy operations from there.

1 comments:
Very nice post! The self-extracting EXE was just what I needed. Here's just a suggestion to make it easier to maintain.
(PropertyGroup)
(ZipName)Temp\Setup.zip(/ZipName)
(TargetExe)FinalFolder\Setup.exe(/TargetExe)
(AutoRunFile)Deploy.bat(/AutoRunFile)
(/PropertyGroup)
(ItemGroup)
(MakeSfxArgs Include="/nogui" /)
(MakeSfxArgs Include="/zip=%22$(ZipName)%22" /)
(MakeSfxArgs Include="/sfx=%22$(TargetExe)%22" /)
(MakeSfxArgs Include="/defaultpath=%22%24curdir%24%22" /)
(MakeSfxArgs Include="/exec=%22$(AutoRunFile)%22" /)
(MakeSfxArgs Include="/autoextract" /)
(MakeSfxArgs Include="/delete" /)
(/ItemGroup)
...
(Exec Command="MakeSFX.exe @(MakeSfxArgs, ' ')" IgnoreExitCode="true" /)
Sorry about the angle brackets - they don't seem to be allowed!
Post a Comment