Expert C# Business Objects
Authors: Lhotka R.
Published year: 2006
Pages: 82-84/111
Buy this book on amazon.com >>

Installing NetRun

NetRun.exe must be installed directly on the hard drive of client workstations. It requires FullTrust to work, and it solves a set of no-touch deployment issues, so we can't really run NetRun itself using no-touch deployment! It must be installed manually, and then it can run other applications using no-touch deployment.

NetRun can be installed to client workstations using XCOPY deployment, or by creating a setup program or MSI file that users can run. This only needs to be done once to get NetRun out there ”after that, we'll simply use NetRun to launch all our other business applications.

When using NetRun as the core deployment strategy for Windows client applications, it's best to view the installation of the .NET runtime and NetRun.exe as a precondition that all client workstations must meet in order to run our applications.

Ideally, NetRun.exe should be installed into a directory that's in the PATH on the client machine. We want to be able to run it directly from any command prompt, from the Start image from book Run dialog box, or from within a shortcut icon. Either install it into a directory that's already in the PATH , or alter the PATH on the machine to include the directory where NetRun.exe resides.

If we don't put NetRun.exe in the PATH , then the user (or the shortcut) will need to type the full path to NetRun.exe , followed by the URL for the program that is to be launched.

Using NetRun

Once NetRun is installed on a client workstation, no further work is required on that machine. To deploy an application to the client, all we need to do is copy the application's EXE and associated DLLs to a directory on our web server.

Note 

If our application uses a .config file, we'll also need to rename that file to have a .remoteconfig extension.

For instance, we can deploy our PTWin client application for use by NetRun . Create a directory on the web server beneath inetpub\ wwwroot , name it Apps , and then create a PTWin directory beneath that. Then copy all files from PTWin\bin to our new inetpub\wwwroot\Apps\PTWin directory on the web server, and rename PTWin.exe.config to PTWin.exe.remoteconfig .

The deployment of our application is now complete! Return to the client workstation, and launch the program using NetRun as follows :


> netrun http://server/apps/ptwin/ptwin.exe

The PTWin application should appear after a brief pause (remember that it had to be downloaded from the server first), but it should run normally.

If we want to deploy a new version of the PTWin application, all we need to do is copy the new version into the web directory on our server. Client applications will automatically download the new versions of the EXE and DLLs the next time the application is launched.

The version-checking mechanism used by no-touch deployment in .NET is the same file date/time check that's used to determine whether a web page is current in the Internet Explorer cache. In other words, the version of each assembly is immaterial it's the file date/time that triggers a client to download a new version of each file.

Conclusion

From a Windows Forms application perspective, no-touch deployment is possibly the most powerful feature of .NET. Unfortunately, no-touch deployment isn't quite as seamless as we'd like it to be, but the NetRun application we've seen here resolves the major issues that we face.

Using NetRun and no-touch deployment, we can deploy Windows Forms applications for the same near-zero cost with which we can deploy Web Forms applications. We simply copy the application and its DLLs to a directory on the web server, and it's automatically deployed or updated to all client workstations.

Expert C# Business Objects
Authors: Lhotka R.
Published year: 2006
Pages: 82-84/111
Buy this book on amazon.com >>

Similar books on Amazon