|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Framework Component Deployment and the Design Process
When you create framework components, such as MessageQueue and EventLog components, the standard development practice assumes that you will first create the necessary system resources on a test computer, using Server Explorer, and then create your components and link them to that test resource.
For example, suppose you are building an order entry system that uses a queue called OrdersReceived to process user data. As your first step, you would create the OrdersReceived test queue and set all of the necessary properties to configure it in a way appropriate for your application. You might set properties to determine the maximum queue size and turn on journal recording for that queue.
After creating the OrdersReceived queue on a test computer, you would create your project and add an instance of the MessageQueue component to it, linking it to the queue. You would then write your code, compile, and test the project without having to deploy it to the final server on which it will reside.
When you are ready to deploy your project, you move it from the test server to its final location on a production server, where the necessary resources that the application used on your test machine need to be recreated. Rather than manually configuring these resources on the new server, you can use installation components to do this work for you. When you add an installation component to your project, it accesses the existing test resources and copies the properties you set when you configured the resources, so that the same resource can later be recreated on the production server.
For example, in the case of the messaging application described above, the installation component for your queue would access the MessageQueue component instance and learn from its properties that it accessed a queue called OrdersReceived, on your test server. The installation component would then access the OrdersReceived queue and copy its configuration properties, including the Path and Label, the journal settings you made, and the maximum queue size. These values are stored in the code for the installation component. When you compile and deploy your project, the necessary resource is created on that computer.
You do not have to follow this design process, but it provides an efficient way to work with your test and production resources. If you do not create and configure a test resource from which property values can be copied to the installation component, you can access the installation component in the ProjectInstaller class (or any class with the RunInstallerAttribute value set to true) and manually set the necessary values to create and install the resource in the state you desire.