15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Clickonce ❘ 421<br />

application. The Prerequisite button displays a list of common prerequisites that can be installed along<br />

with the application. You have the choice of installing the prerequisites from the same location that the<br />

application is being published to or optionally having the prerequisites installed from the vendor’s web site.<br />

The Update button displays a dialog that has the information about how the application should be updated.<br />

As new versions of an application are made available, ClickOnce can be used to update the application.<br />

Options include to check for updates every time the application starts or to check in the background. If<br />

the background option is selected, a specified period of time between checks can be entered. Options for<br />

allowing the user to be able to decline or accept the update are available. This can be used to force an<br />

update in the background so that the user is never aware that the update is occurring. The next time the<br />

application is run, the new version will be used instead of the older version. A separate location for the<br />

update files can be used as well. This way the original installation package can be located in one location<br />

<strong>and</strong> installed for new users, <strong>and</strong> all the updates can be staged in another location.<br />

The application can be set up so that it will run in either online or offline mode. In offline mode the<br />

application can be run from the Start menu <strong>and</strong> acts as if it were installed using the Windows Installer.<br />

Online mode means that the application will run only if the installation folder is available.<br />

application Cache for Clickonce files<br />

Applications distributed with ClickOnce are not installed in the Program Files folder. Instead, they are<br />

placed in an application cache that resides in the Local Settings folder under the current user’s Documents<br />

<strong>and</strong> Settings folder. Controlling this aspect of the deployment means that multiple versions of an application<br />

can reside on the client PC at the same time. If the application is set to run online, every version that the<br />

user has accessed is retained. For applications that are set to run locally, the current <strong>and</strong> previous versions<br />

are retained.<br />

Because of this, it is a very simple process to roll back a ClickOnce application to its previous version. If the<br />

user goes to the Add/Remove Programs Control Panel applet, the dialog presented will contain the choice of<br />

removing the ClickOnce application or rolling back to the previous version. An Administrator can change<br />

the manifest file to point to the previous version. If the administrator does this, the next time the user<br />

runs that application, a check will be made for an update. Instead of finding new assemblies to deploy, the<br />

application will restore the previous version without any interaction from the user.<br />

application security<br />

Applications deployed over the Internet or an intranet have a lower security or trust setting than<br />

applications that have been installed to the local drive. For example, by default, if an application is launched<br />

or deployed from the Internet it is in the Internet Security Zone. This means that it cannot access the file<br />

system, among other things. If the application is installed from a file share, it will run in the Intranet Zone.<br />

If your ClickOnce application requires a higher level of trust than the default, the user will be prompted<br />

to grant the permissions required for the application to run. These permissions are set in the trustInfo<br />

element of the application manifest. Only the permissions asked for in this setting will be granted. So, if<br />

an application asks for file access permissions, Full Trust will not be granted, only the specific permissions<br />

requested.<br />

Another option is to use Trusted Application Deployment. Trusted Application Deployment is a way to<br />

grant permissions on an enterprise-wide basis without having to prompt the user. A trust license issuer is<br />

identified to each client machine. This is done with public key cryptography. Typically, an organization will<br />

have only one issuer. It is important to keep the private key for the issuer in a safe, secure location.<br />

A trust license is requested from the issuer. The level of trust that is being requested is part of the trust<br />

license configuration. A public key used to sign the application must also be supplied to the license<br />

issuer. The license created contains the public key used to sign the application <strong>and</strong> the public key of the<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!