C# Install - Change a custom folder location using install dialog - c#

I am trying to install a windows service using a visual studio setup project. All is going well except I want the user to be able to use the install dialog to specify the location of a custom folder to be created during installation.
I've added a Textboxes dialog that stores a folder location in an Install Property (PATHPROPERTY in this example) but I can't figure out how to use that to change the path of a folder I'm creating during the installation. I set the 'Default Location' Property of the custom folder in the 'File System' menu to:
"[PATHPROPERTY]\folder"
But when I change the path in the install dialog, the folder is created at the default location of PATHPROPERTY, not what I change it to during install. So it seems like the folder is created before I reach the point in my dialog where I ask for the path.
I noticed that there is a Property Property for the folder that I can set and supposedly use to modify the location of the folder during installation, and I've seen some articles suggesting that this can be used to set the location using a command line flag. But I would like to be able to use the install dialog, then possibly set this property in my installer class, but I haven't found any documentation on how to do that yet..
I also found something about Session.Property to set the property but the documentation wasn't clear on how to use this.
Any help would be much appreciated.
Oh. Also. I'm targeting .NET 3.5.

So PATHPROPERTY returns the custom folder location user has selected, If thats the case you have to set that property to "Property" attribute.
Also make sure in the User Interface Editor you are getting the user input before installation starts. (You can move up and down the UI to required position)

Related

How to retain certain file during uninstallation of a winform app?

I would like to retain certain file during uninstall because it contain some configuration info. I don't want to create the file again after I install next time.
Is there a way to do it? Can't seem to find any info regarding this online.
If you use Windows Installer project you can set Permanent = True of your object (right click on your object in your setup project > Properties).

How to skip folder selection form when update installed application via Windows Installer setup project

As the title describes, I am trying to skip the folder selection form when update the installed application via setup project in visual studio(casue the user already selected folder path when they installed the app). I googled online and find a way to disable folder form: http://www.codeproject.com/Tips/437285/Visual-Studio-Deployment-Setup-Disable-Installatio. However, How to know if it is installation or upgrade? If we know it is upgrade, how to get the installation path?
Thanks in advance!
I do not find any approaches to skip that folder form. This should be the reason that many installer tools exist in the market. Since my app is very small, I simply disabled the folder selection dialog. For anyone who are interested, please check this URL: http://www.codeproject.com/Tips/437285/Visual-Studio-Deployment-Setup-Disable-Installatio
If you saved the original install location in the registry, for example by saving [TARGETDIR] in a registry item, then you can retrieve it during an upgrade. You find out you're doing an upgrade because it will set a property called PREVIOUSVERSIONSINSTALLED. The problem is that there is no way to wire it all up in a VS setup project. You want the browse dialog there (not deleted) but you want to skip it if PREVIOUSVERSIONSINSTALLED has been set, and there's no support in VS setup projects for that. You'd need to go into the ControlEvent table in the MSI file and figure out how to skip the browse dialog, as well as have the Back button skip over if necessary, and that's just very difficult.
What's the actual issue? Visual Studio upgrades are complete installs that uninstall the previous product and install the new one wherever the user wants, so why is it necessary to install in the same location as the previous install?

How to add additional custom window to VS setup projects UI flow

I'm using a VS 2008 setup project to deploy my application to client computer.
Now I need to add custom UI Window to get some information form user for set up process.
As example, there should be a form to enter user information after click next button of the destination folder search window.
How can I do this?
If you want to get user input using custom UI during the MSI deployment best approach is to create the .wid extension files. this is the type of UI files that you see during the MSI installation(where you select the installation path etc). Even though visual studio doesn't have features to create these UI files there are Microsoft tools you can use to create these files. One of the best tool is Orca.
Orac.exe
How to use the Orca database editor to edit Windows Installer
files
Once you create the UI file, you have to place the file under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\Deployment\VsdDialogs\1033 (it's where MSI picks the default UI files from)
After that you should be able to select your custom UI and inject it during any phase of installation cycle(beforeinstall, install, afterinstall etc). Then you can pass the value user has entered into the text field as a argument for installer class. Then you can read the value within the installer class using context parameter.
string value = Context.Parameters["ParameterName"];

How to show application version in VS.NET Deployment Project?

I have set up a Deployment Project for my application. The problem is that I want to show application version (eg. MyApplication 1.2.3.1) during installation so the user can see the version before installing.
The only way I can think of is to modify the WelcomeText in Welcome dialog. Is there an easier or more elegant way to achieve this?
You should be able to use the Windows Installer ProductVersion property for this. If you change the Welcome dialog's WelcomeText property to:
The installer will guide you through the steps required to install [ProductName] [ProductVersion] on your computer.
Then you can change the Deployment Project's Version property and have the value automatically displayed. Any string-based property can do this; just use the [] syntax to have the value inserted.
For other properties that are provided out of the box, see the Windows Installer Property Reference
You can get the version number that is set in the executing AssemblyInfo.cs using this code
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
Similarly if you want to get the version number for a specific assembly you can use
System.Reflection.Assembly.GetAssembly([type in my assembly]).GetName().Version.ToString()
You could then change the welcome text automatically at runtime.

How do I change the default Virtual Directory name during a web service install?

I have a C# web service, created using VS2008.
I have a deployment project that creates the MSI I use for deployment.
Is there a setting somewhere to change the default virtual directory that the user is prompted with during the installation?
I'd prefer to not change the name of the webservice to do this.
But isn´t this a simple case of right-clicking the setup project:
select View-> File System.
From the File system explorer, click the Web Application Folder. Press F4 to bring up the properties window (if it isn´t already visible).
In the properties window, scroll down to VirtualDirectory and change it to whatever you want.
Does that work for you?
I think I have the fix.
I couldn't find a fix thru the VS UI, so you'll need to locate your deployment project (file extention is .vdproj) and open in notepad.
Search for "VirtualDirectory"
You'll find a line similar to this:
"VirtualDirectory" = "8:OldName"
Where OldName is the current default you're seeing during installation.
Change "OldName" to whatever you want for a default. Save and build.
If there's a way to do this thru the UI, that would be even better, I couldn't find it and this works.
Visual Studio 2015. The virtual directory can be changed on the properties for the Web.ApplicationFolder for web applications

Categories