By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,586 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,586 IT Pros & Developers. It's quick & easy.

Custom deployment even possible?

P: n/a
I would like to know if the following is even possible with the visual
studio.net Setup and Deployment project.

1. During the deployment after creation of application directory the
setup needs to prompt user to select another location to send a data
file elsewhere on target machine (with ability to create this
directory).
2. After that this secondary location selected/created by the user,
this location needs to be inserted into an XML files which was earlier
placed in the application directory.
Thanks

Aug 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Gene,

I believe so. Here's a quick rundown of how you can accomplish those tasks.

[User Interface Editor]
1. Open the "User Interface Editor" (one of the buttons that appear on top of the Solution Explorer when you have the Setup Project
file selected) and add another dialog to the setup wizard, such as Textboxes (A). I recommend placing it before the "Confirm
Installation" screen. Note the name you assign to the textbox in the Properties Window, for instance Edit1Property=MYDATAFILE,
because you'll need to bind this property to an argument that will be sent to your custom installer class.

[Installer Class]
2. Add a class library to your project, if one doesn't already exist that will ship with the product, and add a new "Installer
Class" file. Here you can override some methods that allow you to retrieve arguments and perform work during installer events.
You'll probably want to override the OnCommitted method to ensure that all of the files necessary to do work have been copied to the
application directory. Use this class to copy the data file from the installation directory to the directory they have chosen in
your custom dialog interface and to modify the xml file. The class can be implemented in any .NET language. To get the location
that the user selected, which your class needs to do its work, you can access the InstallContext.Parameters property. To get your
parameter in that property see the next step.

[Custom Actions Editor]
3. Open the "Custom Actions Editor" and add your class assembly reference as a custom action. The installer will load all of the
Installer Classes in your assembly as part of the installation. Under the Commit folder (the folder you choose depends on the event
you are handling), select your assembly in the Custom Actions Editor and look at the Properties Window. Make sure Installer Class
is set to true. Set CustomActionData to something like this, /MyDataFile="[MYDATAFILE]", where MYDATAFILE is the name of the
TextBox in which the user entered the location and you want to pass into your custom installer class. Access the property like
InstallContext.Properties["MyDataFile"].

FYI, I remember having trouble with variables that represented physical path information that last time I did something like this.
If you have trouble as well there are plenty of resources on the web that explain the property syntax. Also, the CustomActionData
field in general I remember being a bit stubborn in terms of its syntax.

Windows Installer Property Reference on MSDN:
http://msdn.microsoft.com/library/de..._reference.asp

Windows Installer Guide on MSDN:
http://msdn.microsoft.com/library/de..._reference.asp

GL

--
Dave Sexton

"Gene" <ge*********@gmail.comwrote in message news:11**********************@b28g2000cwb.googlegr oups.com...
>I would like to know if the following is even possible with the visual
studio.net Setup and Deployment project.

1. During the deployment after creation of application directory the
setup needs to prompt user to select another location to send a data
file elsewhere on target machine (with ability to create this
directory).
2. After that this secondary location selected/created by the user,
this location needs to be inserted into an XML files which was earlier
placed in the application directory.
Thanks

Aug 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.