• No results found

Package and Deployment

Packaging and deploying applications has had its own fair share of challenges over the years. When discussing application deployment in the workplace, it is difficult to avoid terms such as "DLL Hell," interface compatibility, and registering class GUIDs. Before the .NET Framework, the most significant challenge in deploying applications was registering and un- registering different versions of DLLs. COM implemented a binary standard where all interfaces of a component must be registered in the registry of the operating system.

Whenever an interface, which is defined by its methods, properties, events, and enumerations, changes, the binary compatibility is said to have been broken. The impact of broken

compatibility means that the old DLL is unregistered, a new interface, including a new set of GUIDs, is registered, and all client links to the DLL become invalid. You must recompile and deploy all clients to the changed DLL to correct the broken compatibility.

With Visual Studio.NET, keep in mind the following:

• All .NET Framework applications can be installed using a simple XCopy command. • Visual Studio .NET provides a variety of installation options including Package and

Deployment Project and Package and Deployment Wizards employing intelligence into your deployment package.

Visual Studio .NET Wizards

Visual Studio 6 provided a simple wizard for deploying applications called the Package and Deployment Wizard. Visual Studio .NET provides a set of setup and deployment project types. To create a new setup project, simply create a new project from the Setup and Deployment Projects folder (Figure 5-15).

Figure 5-15: The New Project dialog box with Package and Deployment templates.

The Cab Project

The Cab Project allows you to add files or applications for deployment. Once the Cab files are created, users can run them by double-clicking or they can be downloaded through a browser. For installations that are intended to be run directly by the user, it may be preferable to use the Setup Wizard to create an msi (Windows Installer Files).

The Deployment Wizard

The Deployment Wizard walks you through the process of deploying a .NET application. For example, you can build a deployment package for the EventLogApp, and then run the

installation. To create the package, follow these steps:

1. Create a new project by selecting Deployment Wizard from the Setup Wizard of the New Project dialog box.

2. Name the project EventLogAppSetup and press OK. A wizard appears to walk you

Figure 5-16: The initial dialog box displayed in a deployment wizard.

3. This screen requests information about your application (Figure 5-17). A web

application includes ASP.NET and Web Services applications. Because the Event Log application is a rich client application, select Deploy a Rich Windows Application and click Next.

Figure 5-17: Choosing a package configured for a web or Windows application. 4. The next wizard page allows you to include any additional files your application may

require or files that may add value to your installation, such as readme.txt files (Figure 5-18). You could go ahead and include all of your application files here but we will not. Click Next to continue.

Figure 5-18: Adding additional files to you deployment package.

5. The final deployment wizard dialog box displays all of the choices that you selected so you can verify them before the project is created (Figure 5-19). Select Finish.

Figure 5-19: Viewing a summary of choices that you made.

6. Now it is time to add the EventLogApp application files to the setup package. Right- click on the EventLogApp deployment package and select File from the Add menu. 7. Browse your system and find the EventLogApp application we built earlier in this

chapter. Navigate to the bin directory and select the EventLogApp.exe file, then click Open. The application's dependencies are displayed in the Detected Dependencies folder of the deployment package.

8. Right-click on the deployment project and select Build to create the msi installation file.

9. To run the installation, navigate to the Debug folder of your deployment project and double-click on the EventLogApp.msi file to load the Setup Wizard (Figure 5-20). Select Next.

Figure 5-20: The Event Log sample installation program.

10.Now you can select the application folder to which you want to install your

application (Figure 5-21). You can also choose to install this application for all users of the system or only yourself. Press Next to continue.

Figure 5-21: Selecting the directory for the Event Log application.

11.The next screen lets you know the installation is ready to begin. Click Next to begin the installation. A progress bar should appear briefly, followed by a status screen that indicates a successful installation (Figure 5.22).

Figure 5-22: Selecting the directory for the Event Log application.

The Merge Module Project

The Merge Module Project packages files and other resources that will be used by multiple applications. The file generated by this installation package is an .msi file that is subsequently added to other projects that rely on these shared resources.

Summary

Development tools go a long way to decreasing the time and effort required to deliver a working application. Visual Studio .NET introduces a few new tools and improves upon older ones. Not all the tools available for applications come with Visual Studio .NET. However, they are available for monitoring the performance of your application.

Chapter 6: Designers, Database and

Monitoring Tools

In Chapter 5, "Visual Studio .NET Tools," you learned about various Visual Studio .NET tools that aid in the development, debugging, and deployment of .NET applications. This chapter covers a variety of designers for windows forms, web forms, .NET components, XML, and user controls. You'll examine Visual Database Tools and related database object designers while examining the potential impact of poor database object implementation. Finally, you'll learn about the tools that are available only with Visual Studio .NET Enterprise Edition, including tools for performance monitoring (Visual Studio Analyzer), reporting (Crystal Reports), and Application Boundary enforcement (Enterprise Templates).