430 likes | 539 Views
Building on the .Net Framework. Distributing the Smart Client Application. Microsoft Code Camp II October 16, 2004. Andrew Novick. Agenda. History of Software Distribution .Net Distribution Options XCOPY, No Touch, Updater Application Block Technologies Setup Projects Merge Modules
E N D
Building on the .Net Framework Distributing the Smart Client Application Microsoft Code Camp II October 16, 2004 Andrew Novick
Agenda • History of Software Distribution • .Net Distribution Options • XCOPY, No Touch, Updater Application Block • Technologies • Setup Projects • Merge Modules • Strong Names • Updater Application Block. Distributing the Smart Client Andrew Novick
Novick Software • The consulting company of Andrew Novick • Business Applications • Design – Programming - Project ManagementCoaching - Training • SQL Server, VB, C#, VB.Net, ASP.Net, XML • http://www.NovickSoftware.comHome of the Transact-SQL User-Defined Function of the Week Distributing the Smart Client Andrew Novick
Distributing the Smart Client ApplicationGoals: • Distribute the application and its components to the client with the minimum effort on the part of: • Support staff • End users • Development staff Distributing the Smart Client Andrew Novick
Deployment Circa 1990 REM Load PImage to a workstation C: mkdir PImage cd pimage XCOPY a:\*.* Distributing the Smart Client Andrew Novick
Deployment 1995-2002 DLL Distributing the Smart Client Andrew Novick
Software Solutions • Microsoft System Management Server (SMS) • Microsoft Software Update Service (SUS) • Trivoli • Active Directory - Group Policy • Others…. Distributing the Smart Client Andrew Novick
What Hath .Net Wrought? • Distribution is easier. • Multiple Versions of a component can run side by side. • Global Assembly Cache (GAC) stores shared components • Windows Installer still necessary Distributing the Smart Client Andrew Novick
Strong Names • Strong names can be necessary. • Create a .SNK file using the SN tool in • …Visual Studio 2003\SDK\v1.1\bin • Reference the SNK file in every assembly • Using Interop requires extra steps Distributing the Smart Client Andrew Novick
Strong Names • Guarantee Name Uniqueness • Subsequent versions must be built with the same key file. • Insure that the contents of the assembly file have not been changed since it was producted. Distributing the Smart Client Andrew Novick
GAC • Sound made by a cat when coughing up a hair ball. • Global Assembly Cache • Located in c:\Windows\assembly • Will hold multiple versions of an assembly • Requires Strong Name on all assemblies • Requires Administrator privilege to install Distributing the Smart Client Andrew Novick
Searching for an Assembly • The GAC is searched first! • The default location is where the code is running. • App.Config <codebase> can override the default location Distributing the Smart Client Andrew Novick
Deployment - Requirements • Install COM components • Install Components into the GAC • Create Event Logs • Allow for offline work • Update automatically, even when the application is in use. • Force update when on-line Distributing the Smart Client Andrew Novick
Deployment - Choices • XCOPY • MSI • No-Touch Deployment • No-Touch with NetRun • Updater Application Block (UAB) Distributing the Smart Client Andrew Novick
Deployment Dimensions Distributing the Smart Client Andrew Novick
First Install • How is the 1st install done on each client? • Does it require a setup program to be run? • Can it be deployed some other way? • Preference for automatic install. Distributing the Smart Client Andrew Novick
Updates • How are updates installed? • Is a revised setup required? • Some form of automatic distribution? • Preference is for automatic distribution. Distributing the Smart Client Andrew Novick
Offline • Does the method support working disconnected? • Preference depends on the application.My application requires working offline. Distributing the Smart Client Andrew Novick
Security • What are the security requirements? • Code Access Security (CAS) plays a role. • Sandbox – Code must conform to rules • Full Trust – Code can do anything • Preference varies by application • Full Trust is the easiest to code Distributing the Smart Client Andrew Novick
App.Config • Can an App.Config file be used? • This is always possible. • Are the changes to security settings acceptable? • Preference is for an App.Config Distributing the Smart Client Andrew Novick
COM • Can COM objects be deployed? • How are they registered. • Do we go back to DLL Hell? • Preference depends on the application’s requirements for COM objects. Distributing the Smart Client Andrew Novick
GAC • Can code be installed in the GAC? • Example Infragistics Windows Controls • 10 Megabytes • 5 applications • 4 Versions of each application • = 200 Megabytes if not stored in the GAC • Preference is to put large assemblies that are used by multiple applications and which don’t change into the GAC. Distributing the Smart Client Andrew Novick
Other Files • Can other files be distributed? • Examples • Pictures, databases, • Anti-virus applications may interfere with distribution of vbs, exe, dll, etc.. • Preference is yes. There are always a way to distribute them. Distributing the Smart Client Andrew Novick
Deployment - Analysis Distributing the Smart Client Andrew Novick
XCOPY • Deployment the DOS 4.0 way Distributing the Smart Client Andrew Novick
XCOPY • Works for simple applications • Manual • No Com • No GAC Distributing the Smart Client Andrew Novick
MSI – Setup Project • Visual Studio Setup Project • Creates a Windows Installer MSI file. Distributing the Smart Client Andrew Novick
MSI – Setup Projects • Visual Studio Setup Projects • Create MSI • Installed by Windows Installer • Manual installation required! Distributing the Smart Client Andrew Novick
MSI – Setup Capabilities • Install files into multiple locations • Customizable Screens made with .Net WinForms • Can deploy assemblies into the GAC • Can register COM objects • Can deploy .Net Framework and MSDE • Can include .Net Installation Components Distributing the Smart Client Andrew Novick
Installation Components • Code to perform these tasks: • Create Event Logs • Create MSMQ Queues • Create Databases • Create Performance Counters • Create Windows Services Distributing the Smart Client Andrew Novick
No Touch Deployment • Deploy from IIS Virtual Directory Distributing the Smart Client Andrew Novick
No Touch Deployment • Automatic update of applications via the web. • Application runs in the CAS sandbox. • No disk I/O except Isolated Storage • May only communicate with the site of origin • Restrictions • No COM • No GAC • No App.Config • No non-code files Distributing the Smart Client Andrew Novick
No Touch Deployment with Net Run • Deploy from IIS Virtual Directory Distributing the Smart Client Andrew Novick
Net Run • From Rocky Lhotka’s book:Expert One-on-One Visual Basic Business Objects • NetRun is a WinForms application which is started by a short cut on the client machine. • It runs with Full Trust • It creates an AppDomain and loads the target executable into the AppDomain and starts it. Distributing the Smart Client Andrew Novick
No Touch with NetRun • Requires one-time installation for NetRun and any shortcuts. • Shortcuts point to the NetRun application. • Command line parms tell NetRun where to get the application. • NetRun has FullTrust • it creates an AppDomain • Starts the target app in that AppDomain • The target app has full trust. Distributing the Smart Client Andrew Novick
Updater Application Block • Code based solution from Microsoft Patterns & Practices Distributing the Smart Client Andrew Novick
Updater Application Block (UAB) • Free code from Microsoft Patterns and Practices • Must do the initial install via MSI • COM Okay • GAC Okay • Moderately complex to implement. • Allows • Automatic Update • App.Config • Other Files Distributing the Smart Client Andrew Novick
Alternative Automatic Updating Solutions • No reason that you can’t write your own. • There may be other commercial solutions. Distributing the Smart Client Andrew Novick
Deployment - Choice • Initial MSI • COM install • Crystal component install • Installer project to create event log • Merge Module for Infragistics • Updater Application Block • Downloads and applies updates when they become available (5 min lag) • The implementation can force a the user to wait for a download during application startup. • Using BITS downloader. Distributing the Smart Client Andrew Novick
BITS 2.0 – Oooops! • BITS 2.0 Breaks existing UAB code! • There is a registry change to turn off the extra security checking. • There is an unsupported fix to the code in C# Distributing the Smart Client Andrew Novick
Detect BITS 2.0 Installation • HKEY_LOCAL_MACHINE • \Software\Microsoft\Windows NT\CurrentVersion\Hotfix\KB84277 • Windows XP Service Pack 2 also installs it. Distributing the Smart Client Andrew Novick
Registry Fix for BITS 2.0 Issue • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\BITS • Add DWORD UseLmCompat with value 0 Distributing the Smart Client Andrew Novick
Thanks for Coming • Please send feedback to: anovick@novicksoftware.com www.NovickSoftware.com Distributing the Smart Client Andrew Novick