Development Testing Production
DevelopmentEnvironment TestEnvironment
ProductionEnvironment
TypicallytheDevelopersPersonalComputerwithDatabase,WebServerandProgrammingSoftware
ACleanPC/Server(oranetworkwithPCsandServers)whereyouinstallandtestyourSoftware.Todaywetypicallyset-upaVirtualTestEnvironment
TheCustomersenvironmentwhereyouunstall thefinalsoftware(ServersandClients)
Programming environments suchasVisualStudio,etc.shouldnotbeinstalledinthisenvironment.Youneedtocreate.exefilesetc.inordertomakeyoursoftwarerun.
Developers Developers&Testers Customers
Deployment&Installation
Maintenance
Support
Test/ProductionEnvironmentInfrastructurewithServers,VirtualServers,DatabaseServers,WebServers,etc.
• LocalInfrastructurewithServers&Virtualization• Cloud-basedInfrastructure(monthlypayment),e.g.:–WindowsAzure(VisualStudiohasbuilt-insupportforDeployingtoWindowsAzure)
– AmazonWebServices(AWS)– GoogleCloudPlatform– etc. 3
DeploymentIsitaGenericSoftwareProductoraTailor-madeSoftwareSolution?
– DifferentDeployment/Installationpreparationsrequired!!• GenericSoftware:
• ManyCustomers• TheCustomersinstall theSoftwareitself
• Tailor-made:– TypicallyonlyoneCustomer– TheDeveloperCompanytypicallyinstallsthesoftware(atleast
server-sidecomponents)– IfmanyDesktopClients:ASetupisrequired
4
Setup&DeploymentDesktopApps
• Youneed tocreatean.exefileandaSetupPackage• SetuppackagescanthenbedistributedonCDs/DVDsordownloaded fromaWebPage,etc.• YouusetheSetupinordertoinstallthesoftwareonalltheclients• Timeconsuming,cumbersome,dependsonlocalcomponentsthatmightnotbeinstalled,versionconflicts,etc.Thismakesit
difficult(andalotofworkandtesting)tocreaterobustsetuppackages• Mac:Youcandeploy toMacAppStore,Windows10:Youcandeploy toWindowsStore
WebApps• Noclient installationneeded!• InstalledonaWebServer(IIS,Apache)• AccessedontheClientsusingonlyaWebBrowser• Easy,simpletodeploynewversions,bugfixes,etc.(Customerdont needtodoanything)• ButmakesureyouAppsupportsallmajorWebBrowsers(InternetExplorer,Chrome,FireFox,Opera,Safari)
MobileApps• Deployed to"AppStores"likeAppleAppStore,GooglePlay,WindowsStore(Windows8)
Server-side(Database,Web Services, etc.)• Typicallyasetuppackagethatinstallsthis,ormanuallyifitisatailor-madesolution
5
DifferentDeployment/Installationpreparations requireddepending onwhattypeofAppsyouareDeveloping.
SetupCreationSoftware• InstallShield Professional/Premium
– InstallShieldisaprofessional softwareforcreatinginstallers,Price€2000+• WiX Toolset (WindowsInstallerXML)(Free)
– UsedtocreateWindowsInstallerpackages("MSIfiles)– TheWiXtoolsetbuildsWindowsinstallationpackagesfromXMLsourcecode.– FreeandOpenSource– Usedbye.g.,Microsoft tocreateSetuppackagesforOffice,SQLServer,Visual
Studio,etc.Apple,etc.alsouseit.• InnoSetup
– FreeofchargeInstallerforWindowsprograms• NSIS (NullsoftScriptableInstallSystem)
– ProfessionalopensourcesystemtocreateWindows installers.• etc.
6
Setup&DeploymentinVisualStudio• InstallShieldLimitedEdition(InstallShieldProfessionalisaprofessional softwarefor
creatinginstallers,Price€2000+)– Toolforcreatingsetuppackages– "Included"(free),butneedstobeenabledanddownloaded– IntegrateswithVisualStudio(Prof.edcanbeusedindependently)
• WiXToolset (Windows InstallerXML)– UsedtocreateWindowsInstallerpackages("MSIfiles)– CanbeusedinVisualStudioorindependently
• ClickOnceDeployment.PublishingDesktopAppstoaWebServer.Userscantheninstallthemwithasingleclick.
• Deployment toWindowsAzure("Windows intheCloud").MonthlyPayment• WebApps(WebDeploy)
– Createa“WebDeploymentPackage”whichcanbeimportedusingIIS• MobileApps:WindowsStoreApps
– Built-inDeploymentinsideVisualStudiotoWindowsStore
7
Setup&DeploymentinVisualStudio
8
http://msdn.microsoft.com/en-us/library/wtzawcsz.aspxDeployingApplications,Services,andComponents:
4ExercisesA.CreateSetupPackages/Installers:Canbeusedtoinstallallkindofsoftware/components
1. InstallShieldLE(LimitedEdition)2. WiX
B.DeployWebSitesonIIS:3. WebPackageDeployment
C.WinFormorWPFApps:4. ClickOnceDeployment
9
CreateaWinFormApp
12
ThisistheAppthatshallbeinstalledfromaSetup
Thisisjustanexample– createwhateveryoulike
BuildyourAppandmakesureitworks!
InstallShieldLimitedEditionToenable InstallShieldLimitedEdition:1. Onthemenubar,chooseFile,New,Project.2. IntheNewProjectdialogbox,expandtheOther
ProjectTypesnode,andthenchoosetheSetupandDeploymentnode.
3. Inthetemplatelist,chooseEnableInstallShieldLimitedEdition,andthenchoosetheOKbutton.
4. Inthebrowserwindowthatopens,readtheinstructions,andthenchoosetheGotothedownloadwebsitelink.
13
forVisualStudio
Seenextslideforscreenshot...
InstallShieldLimitedEdition
21
forVisualStudio
etc.,GothroughallthestepsintheWizard
Finally:• BuildtheSetupProject• TestyouSetup(preferablyonaVirtual
Machineoraseparatetestcomputer(why?))
InstallShieldLimitedEdition
22
forVisualStudio
ThisisyourSetupFiles/SetupPackage
CopytheSetupPackagetotheComputerwhereyouwanttotestitandRun“Setup.exe”
WiXDocumentation
• WiXManual:http://wixtoolset.org/documentation/manual/v3/• WiXTutorial:http://wix.tramontana.co.hu
28
WiXExample
http://wixtoolset.org/documentation/manual/v3/votive/authoring_first_votive_project.html
Inthisexample,wewillcreateaC#WindowsFormApplicationandthenuseWiXtocreateaninstallerfortheapplication.
Step1:CreatetheC#WindowsFormApplication• ClickFile, thenselectNew,thenselectProject.• Choose theVisualC#node intheProjectTypes tree,thenselectWindows FormsApplication.• Nameyourapplicatione.g.,"MyApplication”(Usewhateveryouwant)andpressOK.Step2:CreatetheInstallerfortheapplication• ClickFile, thenclickNew,thenclickProject.• Choose theWindows InstallerXMLnodeintheProjecttypestree,thenselectWiXProject• Nameyourproject"MySetup"andpressOK.• IntheMySetupproject,right-clickontheReferencesnodeandchooseAddReference....• NavigatetotheProjectstab,clickontheMyApplicationproject,andclicktheAddbutton,andthenpressOK.• Find thecommentthatsays:
<!-- TODO:Insertyourfiles, registrykeys,andotherresourceshere.-->Deletethatlineandreplaceitwiththefollowinglines ofcode:<FileSource="$(var.MyApplication.TargetPath)"/>
• BuildtheWixproject
CreateaWinFormApp
31
ThisistheAppthatshallbeinstalledfromaSetup
Thisisjustanexample– createwhateveryoulike
<?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="MySetup" Language="1033" Version="1.0.0.0" Manufacturer="Telemark University College" UpgradeCode="2ee9a35c-e8ba-4197-a97f-192b80a1d6bf">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="MySetup" Level="1"><ComponentGroupRef Id="ProductComponents" /></Feature>
</Product>
<Fragment><Directory Id="TARGETDIR" Name="SourceDir"><Directory Id="ProgramFilesFolder"><Directory Id="INSTALLFOLDER" Name="MySetup" /></Directory></Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent"> <File Source="$(var.WinFormApp.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment></Wix>
TheInstaller/SetupisReady
35
RuntheInstaller(“MySetup.msi”) inordertoinstallyourSoftware
Note!ThisSetuphasnoGUI– itjustinstallsyoursoftware(moreadvancedsetupscanofcoursebecreated)
38
That'sit!Nowyouhaveaworkinginstallerthatinstallsanduninstallstheapplication.ThiswasaverysimpleInstallerwithnoWizardorinteractionwiththeuserduringInstallation.
WithWixyoucandoallthisandmore.
FormoreinformationaboutWiX,setheonlinedocumentation.
WiXManual:http://wixtoolset.org/documentation/manual/v3/WiXTutorial:http://wix.tramontana.co.hu
WebDeploymentAlternatives:- Createa“InstallationPackage”thatyouortheCustomerneedtoinstallontheserver(WebDeployPackage)
- Deploydirectlytotheserverusing“WebDeploy”(Youneedtohaveonlineaccesstotheserver)
- Deploydirectlytotheserverusing“FTP”(Youneedtohaveonlineaccesstotheserver)
- ...
43
WebPackageDeployment
45
Note!InordertostartonthisExercise,youneedtocreateanASP.NETprojectoruseanexistingASP.NETProject.
Right-clickon theASP.NETProjectintheSolution ExplorerinVisualStudioandselect“Publish...”
Ifyoumissthe“Deploy”option,makesuretoinstallthe“WebDeploy”features.YoumaydownloadandinstallitfromWebPI(WebPlatformInstaller)(Googleitanddownloadit)
46
CreateWebPackageWizard
48
IfyourWebAppusesaDatabaseconnectioninWeb.config, youmaysetuptheConnectionStringontheServerhere.
xxx
PreparationYouneedtoinstallthe“WebDeploy”softwareontheServerDownloadWebPI(WebPlatformInstaller)andthenselecttoInstall“WebDeployforHostingServers”
50
ClickOnceDeployment• ClickOnceisadeploymenttechnologythatenablesyouto
createself-updatingWindows-basedapplicationsthatcanbeinstalledandrunwithminimaluserinteraction.
• AClickOnceapplicationisanyWindowsPresentationFoundation(.xbap),WindowsForms(.exe),consoleapplication(.exe),orOfficesolution(.dll)publishedusingClickOncetechnology.
• Youcanpublisha ClickOnceapplicationinthreedifferentways:– fromaWebpage– fromanetworkfileshare– frommediasuchasaCD-ROM.
58
59
Right-clickonyourWinFormorWPFProjectintheSolutionExplorer
SelectwhereyouwanttostoretheInstaller.
ThenyoucandistributethelinktotheUsersthatneedtoinstalltheapplication
61
TheInstallationPacckagewascreated:
CopytheInstallationPakagetotheServer
GivethelinktotheUsersthatshalltoInstallandusetheSoftware
Hans-PetterHalvorsen,M.Sc.
UniversityCollegeofSoutheastNorwaywww.usn.no
E-mail:[email protected]:http://home.hit.no/~hansha/