Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Real World  ClickOnce Expert Tips for Practical Use Presented by Craig Adams Senior Architect at Vivus Software
Agenda <ul><li>Introduction </li></ul><ul><li>Initial Deployment </li></ul><ul><li>Updating </li></ul><ul><li>Managing Fil...
What is ClickOnce? <ul><li>Framework 2.0 deployment Technology </li></ul><ul><li>Targets Windows Forms applications </li><...
Deployment Modes <ul><li>Install Mode </li></ul><ul><li>On-line only Install Mode </li></ul><ul><li>CD Deployment </li></u...
Client Software Requirements <ul><li>Framework 2.0 </li></ul><ul><li>Internet Explorer 5.5 </li></ul><ul><li>Prerequisites...
Server Software Requirements <ul><li>Doesn’t need to be a windows server </li></ul><ul><li>Return file requests for the de...
What to Deploy <ul><li>ClickOnce applications are isolated  </li></ul><ul><li>Applications that aren’t invasive </li></ul>...
Limitations of ClickOnce <ul><li>No control over the folder location where your application is deployed </li></ul><ul><li>...
Smart Client Architecture <ul><li>Windows Application </li></ul><ul><li>Enterprise functionality  </li></ul><ul><li>Offlin...
Initial Deployment with ClickOnce – Publishing Options <ul><li>HTTP </li></ul><ul><ul><li>Wider reach </li></ul></ul><ul><...
Initial Deployment with ClickOnce – Publishing Location <ul><li>HTTP publishing </li></ul><ul><ul><li>http://DeploymentSer...
Initial Deployment with ClickOnce – Installation URL <ul><li>Full HTTP or UNC path to the folder that will contain the dep...
Manifest generation and signing <ul><li>Deployment manifest </li></ul><ul><li>Application manifest </li></ul><ul><ul><li>f...
Deployment Manifest <ul><li>Can perform a server side roll back by overwriting the default deployment file with the versio...
DEMO <ul><li>Server Side Rollback </li></ul>
Launching / installing the Application <ul><li>The user needs only a link to the deployment manifest </li></ul><ul><li>Dep...
Manifest Validation <ul><li>Schema validation </li></ul><ul><li>Digital signature validation </li></ul><ul><ul><li>Is the ...
Install and Runtime Security <ul><li>Trustworthy deployment </li></ul><ul><li>Obfuscated file structure </li></ul><ul><li>...
User Cache <ul><li>Application files are placed in an obfuscated folder structure for security purposes </li></ul><ul><li>...
Moving an Application to Production <ul><li>Installation URL sets the deployment provider in the Deployment manifest </li>...
DEMO <ul><li>Moving deployment to production </li></ul><ul><ul><li>Move to a different server using Mage UI </li></ul></ul...
Demo <ul><li>Moving from Live back to Test while in production using .bat file </li></ul>Intro  Init Deployment   Updating...
Updating an Application <ul><li>Deploying the update </li></ul><ul><li>Client Update </li></ul><ul><ul><li>If update is op...
Demo <ul><li>Manually Publishing an Update with Mageui </li></ul>Intro  Init Deployment  Updating   Managing Files  Wrappi...
Install Mode and Updates <ul><li>On-line Only – always has most recent </li></ul><ul><li>Installed application – check for...
Schedule Update Checking <ul><li>Enabled when “check for updates after launch” enabled </li></ul><ul><li>Perform checking ...
Minimum Required Version <ul><li>Update cannot be skipped </li></ul><ul><li>Cannot cancel the download/install </li></ul><...
Specifying an update location <ul><li>The location to look for updates when the application is launched </li></ul><ul><li>...
Update Tip <ul><li>Server version only has to be  different  not  higher  to cause an update.  </li></ul>Intro  Init Deplo...
Update Facts <ul><li>Updates are done in a transactional manner </li></ul><ul><li>ClickOnce only maintains two versions   ...
On-demand Updates <ul><li>Can mix with ClickOnce enabled updates </li></ul><ul><ul><li>Might have scheduled updating once ...
ClickOnce API <ul><li>System.Deployment.Application namespace </li></ul><ul><li>System.Windows.Forms.Application </li></ul...
DEMO <ul><li>Using Code to perform updates </li></ul>Intro  Init Deployment  Updating   Managing Files  Wrapping Up
Application and Data Files <ul><li>Referenced assemblies will be included as application files  </li></ul><ul><ul><li>copy...
DEMO <ul><li>Download groups </li></ul>Intro  Init Deployment  Updating  Managing Files   Wrapping Up
Managing Application Files with Mage and MageUI <ul><li>Located in C:Program FilesMicrosoft Visual Studio 8SDKv2.0Bin on a...
Data Files <ul><li>Visual Studio 2005 </li></ul><ul><ul><li>Add to project with build action to  content </li></ul></ul><u...
Works with ClickOnce Deployed or debug  //Works with ClickOnce Deployed or debug  private void  LoadData() { string  dataP...
Data Migration <ul><li>New version, data is copied from the previous version’s data folder to the new version’s data folde...
Demo <ul><li>Data Migration </li></ul>
Client Side Caching <ul><li>SQL Server 2005 Express </li></ul><ul><ul><li>Full featured database </li></ul></ul><ul><ul><l...
Connections <ul><li>SQL Server 2005 Compact Edition </li></ul><ul><ul><li>string DataConnectionString = @&quot;Data Source...
Other ClickOnce Areas <ul><li>Prerequisite Deployment with Bootstrapper </li></ul><ul><li>Deploying Unmanaged Applications...
Visual Studio 2008 <ul><li>WPF Web Browser Apps </li></ul><ul><li>Resigning application now supported </li></ul><ul><li>Vi...
Resources <ul><li>Smart Client Deployment with ClickOnce: Deploying Windows Forms Applications with ClickOnce by Brian Noy...
Thank you for your time Any Questions? Please send additional questions/comments to  [email_address]
Upcoming SlideShare
Loading in …5
×

Real World Click Once

2,556 views

Published on

Presentation covers deploying .NET applications using Click Once.

  • Be the first to comment

Real World Click Once

  1. 1. Real World ClickOnce Expert Tips for Practical Use Presented by Craig Adams Senior Architect at Vivus Software
  2. 2. Agenda <ul><li>Introduction </li></ul><ul><li>Initial Deployment </li></ul><ul><li>Updating </li></ul><ul><li>Managing Files </li></ul><ul><li>Wrapping Up </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  3. 3. What is ClickOnce? <ul><li>Framework 2.0 deployment Technology </li></ul><ul><li>Targets Windows Forms applications </li></ul><ul><li>Smart Client Applications </li></ul><ul><ul><li>Rich Client Applications </li></ul></ul><ul><ul><li>Usually a Distributed Applications </li></ul></ul><ul><ul><li>Network deployed and updated </li></ul></ul><ul><ul><li>Runs securely on Client Machine </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  4. 4. Deployment Modes <ul><li>Install Mode </li></ul><ul><li>On-line only Install Mode </li></ul><ul><li>CD Deployment </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up occasionally connected always connected cd deployment
  5. 5. Client Software Requirements <ul><li>Framework 2.0 </li></ul><ul><li>Internet Explorer 5.5 </li></ul><ul><li>Prerequisites for your application </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  6. 6. Server Software Requirements <ul><li>Doesn’t need to be a windows server </li></ul><ul><li>Return file requests for the deployment manifest, application manifest and files via HTTP or UNC </li></ul><ul><li>Must return the appropriate MIME file types in the Http headers so they are handled correctly on the client </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  7. 7. What to Deploy <ul><li>ClickOnce applications are isolated </li></ul><ul><li>Applications that aren’t invasive </li></ul><ul><li>Doesn’t natively support complex setups </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  8. 8. Limitations of ClickOnce <ul><li>No control over the folder location where your application is deployed </li></ul><ul><li>Other applications cannot locate your application through any supported means </li></ul><ul><li>No custom install steps inherent in ClickOnce </li></ul><ul><li>Not for every application </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  9. 9. Smart Client Architecture <ul><li>Windows Application </li></ul><ul><li>Enterprise functionality </li></ul><ul><li>Offline Caching </li></ul><ul><li>Middle Tier </li></ul><ul><li>Client application decoupled from Client Machine </li></ul><ul><li>ClickOnce requirements need to be considered in the high level architecture early </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  10. 10. Initial Deployment with ClickOnce – Publishing Options <ul><li>HTTP </li></ul><ul><ul><li>Wider reach </li></ul></ul><ul><li>UNC network or file path </li></ul><ul><ul><li>Limited to those who have access to the network </li></ul></ul><ul><li>CD-ROM or DVD </li></ul><ul><ul><li>Good option if you have a large set of requirements </li></ul></ul><ul><ul><li>Can be configured to still get updates from the web </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  11. 11. Initial Deployment with ClickOnce – Publishing Location <ul><li>HTTP publishing </li></ul><ul><ul><li>http://DeploymentServer/myApp/ </li></ul></ul><ul><li>UNC Publishing </li></ul><ul><ul><li>eploymentServermyApp </li></ul></ul><ul><li>FTP Publishing </li></ul><ul><ul><li>ftp://DeploymentServer/myFolder/ </li></ul></ul><ul><li>Drive Letter Publishing </li></ul><ul><ul><li>C:myFolderMyApp </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  12. 12. Initial Deployment with ClickOnce – Installation URL <ul><li>Full HTTP or UNC path to the folder that will contain the deployment manifest </li></ul><ul><li>Deployment manifest filename is implicitly set </li></ul><ul><ul><li>URL to users for HTTP would be: http:// deploymentServer/myApp/myApp.application </li></ul></ul><ul><li>Installation URL is stored in the Deployment Manifest under a setting called “DeploymentProvider” </li></ul><ul><li>Default is blank and will use the Publishing Location </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  13. 13. Manifest generation and signing <ul><li>Deployment manifest </li></ul><ul><li>Application manifest </li></ul><ul><ul><li>files the applications contains and required permissions </li></ul></ul><ul><li>Both files are digitally signed during creation </li></ul><ul><ul><li>Guarantees that the application hasn’t been tampered with </li></ul></ul><ul><ul><li>Guarantees the application was signed by whoever the publish is that holds the certificate </li></ul></ul><ul><li>If modified needs to be resigned </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  14. 14. Deployment Manifest <ul><li>Can perform a server side roll back by overwriting the default deployment file with the version specific </li></ul><ul><li>Contains identify, descriptive and deployment information </li></ul><ul><li>Deployment Provider – used to initially launch the application </li></ul><ul><li>For the purposes of moving the deployment location the Deployment Provider on the server can be modified to point to a new server, or website </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  15. 15. DEMO <ul><li>Server Side Rollback </li></ul>
  16. 16. Launching / installing the Application <ul><li>The user needs only a link to the deployment manifest </li></ul><ul><li>Deployment manifest is downloaded and the digital signature is used to determine if the manifest has been tampered with </li></ul><ul><li>Runtime gets the deployment provider from the manifest </li></ul><ul><li>Application Manifest is taken from the deployment manifest and downloaded to the client </li></ul><ul><li>Prerequisite check performed and installed if necessary </li></ul><ul><li>Application files are downloaded as a separate request for each file </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up Link Clicked by user Process Deployment manifest Deployment provider Application Manifest Prerequisite Check Application Files
  17. 17. Manifest Validation <ul><li>Schema validation </li></ul><ul><li>Digital signature validation </li></ul><ul><ul><li>Is the signature valid based on current contents </li></ul></ul><ul><li>Semantic Validation </li></ul><ul><ul><li>Checks to make sure values are within the allowable values </li></ul></ul><ul><li>ClickOnce does not let you publish updates with a different publisher certificate </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  18. 18. Install and Runtime Security <ul><li>Trustworthy deployment </li></ul><ul><li>Obfuscated file structure </li></ul><ul><li>Isolation occurs for each user, for each application for each version </li></ul><ul><li>Application gets launched by ClickOnce and ensures that the permissions granted by the user upon installation are applied </li></ul><ul><li>If full trust has been granted by the user (default), the application takes on permissions of the user </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  19. 19. User Cache <ul><li>Application files are placed in an obfuscated folder structure for security purposes </li></ul><ul><li>Current folder schema </li></ul><ul><ul><li>Windows XP </li></ul></ul><ul><ul><ul><li>C:Documents and Settings<username>Local SettingsApps </li></ul></ul></ul><ul><ul><li>Vista </li></ul></ul><ul><ul><ul><li>C:Users<username>App DataLocalApps </li></ul></ul></ul><ul><li>Cache exist for current version and one previous version </li></ul><ul><li>Users can roll back to a previous version </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  20. 20. Moving an Application to Production <ul><li>Installation URL sets the deployment provider in the Deployment manifest </li></ul><ul><li>Change the Deployment Provider setting in the Deployment manifest to the new setting </li></ul><ul><li>Change the deployment provider by using mageui.exe or mage.exe </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  21. 21. DEMO <ul><li>Moving deployment to production </li></ul><ul><ul><li>Move to a different server using Mage UI </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  22. 22. Demo <ul><li>Moving from Live back to Test while in production using .bat file </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  23. 23. Updating an Application <ul><li>Deploying the update </li></ul><ul><li>Client Update </li></ul><ul><ul><li>If update is optional, the user will be prompted </li></ul></ul><ul><ul><ul><li>If they choose to skip the update, the user will not be prompted again for 7 days. </li></ul></ul></ul><ul><li>Forcing an update </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  24. 24. Demo <ul><li>Manually Publishing an Update with Mageui </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  25. 25. Install Mode and Updates <ul><li>On-line Only – always has most recent </li></ul><ul><li>Installed application – check for updates </li></ul><ul><ul><li>Before launch – foreground thread </li></ul></ul><ul><ul><ul><li>Deployment manifest downloaded each time </li></ul></ul></ul><ul><ul><ul><li>Users kept up to date </li></ul></ul></ul><ul><ul><li>After launch – uses background thread </li></ul></ul><ul><ul><ul><li>Updates are not timely </li></ul></ul></ul><ul><ul><ul><li>Once per session </li></ul></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  26. 26. Schedule Update Checking <ul><li>Enabled when “check for updates after launch” enabled </li></ul><ul><li>Perform checking on a scheduled basis instead of each time the application launches </li></ul><ul><li>Interval begins when the application gets installed </li></ul><ul><li>Warning: interval dialog does not do validation </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  27. 27. Minimum Required Version <ul><li>Update cannot be skipped </li></ul><ul><li>Cannot cancel the download/install </li></ul><ul><li>Can’t rollback to a version lower than the minimum required version </li></ul><ul><li>Schema changes, middle tier component changes </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  28. 28. Specifying an update location <ul><li>The location to look for updates when the application is launched </li></ul><ul><li>Written to deployment provider in the manifest </li></ul><ul><li>Used for two reasons </li></ul><ul><ul><li>Deploying initially from CD </li></ul></ul><ul><ul><li>Disabling automatic updates </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  29. 29. Update Tip <ul><li>Server version only has to be different not higher to cause an update. </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  30. 30. Update Facts <ul><li>Updates are done in a transactional manner </li></ul><ul><li>ClickOnce only maintains two versions </li></ul><ul><li>User can role back to a previous version as long as it is not below the minimum required version </li></ul><ul><li>Forcing a server side rollback </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  31. 31. On-demand Updates <ul><li>Can mix with ClickOnce enabled updates </li></ul><ul><ul><li>Might have scheduled updating once a month with a menu option that allows the user to check for updates </li></ul></ul><ul><li>Might turn off ClickOnce updates completely </li></ul><ul><ul><li>Application usage may prevent timely updates </li></ul></ul><ul><ul><li>ClickOnce API could be used to check for updates and prompt after an update has been downloaded </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  32. 32. ClickOnce API <ul><li>System.Deployment.Application namespace </li></ul><ul><li>System.Windows.Forms.Application </li></ul><ul><ul><li>Used to call method to restart the application </li></ul></ul><ul><li>Warning: Programmatic updates require full trust </li></ul><ul><li>Warning: Update Location required when automatic update is turned off </li></ul><ul><li>Warning: Always check to make sure application is deployed using ClickOnce </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  33. 33. DEMO <ul><li>Using Code to perform updates </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  34. 34. Application and Data Files <ul><li>Referenced assemblies will be included as application files </li></ul><ul><ul><li>copy local setting on the file has been set </li></ul></ul><ul><li>Files must be apart of your project to be included automatically deployment </li></ul><ul><ul><li>Set the build action to content for files that you want to be automatically deployed </li></ul></ul><ul><li>Publish Status </li></ul><ul><li>Download Group </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  35. 35. DEMO <ul><li>Download groups </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  36. 36. Managing Application Files with Mage and MageUI <ul><li>Located in C:Program FilesMicrosoft Visual Studio 8SDKv2.0Bin on an XP machine </li></ul><ul><li>Allows adding additional application files without redeploying </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  37. 37. Data Files <ul><li>Visual Studio 2005 </li></ul><ul><ul><li>Add to project with build action to content </li></ul></ul><ul><ul><li>Mark with a publish status of data file </li></ul></ul><ul><li>Programmatically accessing: </li></ul><ul><ul><ul><li>Application.UserAppDataPath </li></ul></ul></ul><ul><ul><ul><li>ApplicationDeployment.DataDirectory </li></ul></ul></ul><ul><ul><ul><li>Relative pathing - MediaMyPhoto.jpg </li></ul></ul></ul><ul><li>Dealing with data files </li></ul><ul><ul><ul><li>Set copy to output directory – copy always or copy if changed </li></ul></ul></ul><ul><ul><ul><li>Debug vs ClickOnce Deployed </li></ul></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  38. 38. Works with ClickOnce Deployed or debug //Works with ClickOnce Deployed or debug private void LoadData() { string dataPath; if (ApplicationDeployment.IsNetworkDeployed) dataPath = ApplicationDeployment.CurrentDeployment.DataDirectory; else dataPath = &quot;.&quot;; dataPath += @&quot;Customers.xml&quot;; } Intro Init Deployment Updating Managing Files Wrapping Up
  39. 39. Data Migration <ul><li>New version, data is copied from the previous version’s data folder to the new version’s data folder </li></ul><ul><li>If schema for the data changed, the newly deployed data file will be copied to the data folder for the newly deployed application </li></ul><ul><ul><li>The data file from the previous version is copied to a dataFolder.pre </li></ul></ul><ul><ul><ul><ul><li>Unless this datafile is migrated to a newer version it will be lost when the next update is installed </li></ul></ul></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  40. 40. Demo <ul><li>Data Migration </li></ul>
  41. 41. Client Side Caching <ul><li>SQL Server 2005 Express </li></ul><ul><ul><li>Full featured database </li></ul></ul><ul><ul><li>Large footprint (53 mb) (admin) </li></ul></ul><ul><li>SQL Server 2005 Compact Edition </li></ul><ul><ul><li>Small footprint (1.4mb) </li></ul></ul><ul><ul><li>No stored procedures </li></ul></ul><ul><ul><li>Installed as a prerequisite (Admin) or adding DLL files (No Admin) </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  42. 42. Connections <ul><li>SQL Server 2005 Compact Edition </li></ul><ul><ul><li>string DataConnectionString = @&quot;Data Source=|DataDirectory|Northwind.sdf &quot;; </li></ul></ul><ul><ul><li>SqlCeConnection newConnection = new SqlCeConnection(DataConnectionString); </li></ul></ul><ul><li>SQL Server 2005 SQL Express </li></ul><ul><ul><li>User instances </li></ul></ul><ul><li>string DataConnectionString = @&quot;Server=.sqlexpress;Database=Northwind;AttachDBFileName= </li></ul><ul><ul><li>|DataDirectory|Northwind.mdf;User Instance=True; Integrated Security=true;“; </li></ul></ul><ul><ul><li>SqlConnection newConnection = new sqlConnection(DataConnectionString); </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  43. 43. Other ClickOnce Areas <ul><li>Prerequisite Deployment with Bootstrapper </li></ul><ul><li>Deploying Unmanaged Applications </li></ul><ul><li>Reg-Free COM </li></ul><ul><li>Pushing ClickOnce Installations to the Client Machine </li></ul><ul><li>MSBuild ClickOnce Publishing </li></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  44. 44. Visual Studio 2008 <ul><li>WPF Web Browser Apps </li></ul><ul><li>Resigning application now supported </li></ul><ul><li>Visual Studio Tools for Office (VSTO) Apps </li></ul><ul><li>Works with Firefox, Opera and Safari </li></ul><ul><li>Supports file associations </li></ul><ul><ul><li>Identifies a name extension to be used with app </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  45. 45. Resources <ul><li>Smart Client Deployment with ClickOnce: Deploying Windows Forms Applications with ClickOnce by Brian Noyes </li></ul><ul><li>Deploying ClickOnce Applications with Firefox </li></ul><ul><ul><li>https://addons.mozilla.org/firefox/1608/ </li></ul></ul><ul><li>ClickOnce Community Resource Kit </li></ul><ul><ul><li>http://www.codeplex.com/smartclient/Project/FileDownload.aspx?DownloadId =5060 </li></ul></ul><ul><li>Vista and ClickOnce </li></ul><ul><ul><li>http:// www.softinsight.com/bnoyes/PermaLink.aspx?guid =435524e7-340c-4b4b-933d-a1c38d27e8ea </li></ul></ul>Intro Init Deployment Updating Managing Files Wrapping Up
  46. 46. Thank you for your time Any Questions? Please send additional questions/comments to [email_address]

×