setup and deployment vs2010 project Configure Open with My application - c#

FIRST
I am writing a setup and deployment project in vs2010 and would like to know how can I make certain files open with my application. In other-words I want ( after installation) to be able to right click a specific file and open it with my app.
SECOND
I don't want to replace the default program associated with this files but I just what my app to appear in the list of apps to choose from when a specific file is right clicked
Now I know I have to change the registry by adding/changing key(s) but I don't know which ones and don't what to change the wrong ones. So far I have figured out how to add the keys (sort of) in this stack overflow question
Installer Custom Action problem - can't write to register key

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?

Creating Custom installer in visual studio that allows separate installation for Client and Server

I have been planning to create a installer using the "Setup Project" included in visual studio. I want to create this in such a manner that it allows separate Client/Service installation using a single MSI file.
Can anyone guide me the right direction/Steps to follow.
To elaborate it a bit more the client application will be a desktop application and the server app will be windows service.
In general, you add a RadioButtons (2) dialog to your setup from the canned list, and make the user choose one, or checkboxes if both are allowed. If it's radio buttons, there's a property BUTTON2 which will be 1 or 0 depending on which was selected. Then each file for client or server you set a condition BUTTON2=1 as appropriate.
There are some nasty gotchas. One is that a repair will go through reinstall and the value of BUTTON2 will be undefined so you'll get unexpected results. One way to deal with this is to create a registry item with the value [BUTTON2] so that the value is saved in the registry, then you can add a search for that value to re-initialize it in case of repair.
VS setups don't have a good way of doing this because they don't have multiple features that you can choose from, and that can be modified by going into Programs&Features and changing them. VS setups all have a single feature, so all you can do is condition the files/components being installed based on checkboxes and radio buttons.
The properties window of every file being installed (Solution Explorer pane) includes a Condition property. Selecting the file in Solution Explorer then doing F4 shows the properties window.

Add registry file (*.reg) to setup project

I see how to update the registry manually, by right-clicking on the project, select View, then Registry, but I have alot of registry changes that I need to incorporate into my setup project, and I've already exported each of them to a *.reg file. I don't want to have to go through and add each of them for the setup project manually again.
How can I add my *.reg registry files into the setup project?
As noted in the comment, right-click the "Registry on Target Machine" root node and click Import. It will ask for a .reg file. And will populate the tree with what it found in the .reg file. Just repeat this if you have more than one .reg file.
The Setup project designer doesn't exactly have the most discoverable user interface. It uses right-click context menus a lot and commands are scattered between context menus, regular menus and buttons. So if you are looking for a feature that you think ought to be there then some wishful left and right-clicking on UI widgets can help you get lucky. Spending ten Friday afternoon minutes clicking away is advisable. Note that it was removed from VS2012 and won't come back, it is still available in the gallery.
Just right click the project and add the file to your setup project. Have your application go through the .reg file on first run to make sure the registry is properly set up.
You may add or update your .reg files programatically. Let's say, for example, that you may want to merge a given file.reg to your registry:
Process _re = Process.Start("regedit.exe", "/s file.reg");
_re.WaitForExit();
(Just keep in mind that newer Windows versions use Unicode instead of ANSI when creating/consuming .reg files.)

Simplifying setup and deployment in c#

I have made an application, which keeps getting updated frequently. So every time a change occurs, i've to include it's fresh builds to the setup and deployment program again and again. Is there any way to simplify the procedure? The files to be added are static in number and exist in a folder. I've heard we can write installer classes in c#, does my requirement has any thing to do with it?
I think ClickOnce doesn't suit my requirement because, for the first time i want it to run like a setup package, since it has some packages and some settings needed to be implemented on the user's machine at the time of install. Can click once help me with that? Also i want to run my application as an administrator and it references to many external dll files. So will it help my purpose?
I finally did it using clickonce deployment. I used content files to mark all the files i wanted to copy to the target computer and used clickonce deployment. Then i modified the way my program starts, so that i can lauch the installer script i wanted to run only when the app runs for the first time. Further i hosted it on IIS and had to change lot of MIME types and add new ones for the download to work over internet
Look into something called "ClickOnce" deployment. It automates a lot of what you're talking about.
EDIT: You can add custom installer actions to a ClickOnce project just like any other, to set up additional components and whatnot. As for permissions, ClickOnce will let you run as administrator if you so choose, but that sort of thing isn't recommended, and it might whine about it.
You can use ClickOnce (http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx) which simplify the deployment process.
Maybe you can also automate the build process using NANT (http://nant.sourceforge.net/).
HTH
Yes, you can do that.
I assume you want the client to update itself when ever there is a new version.
This needs a few changes in the client code. Essentially how it works is check for availablilty of new version at a predefined location. Update you new versions to this location. On the client side, show a message to the user if he/she wants to upgrade to the new version.
You can find a link to sample project out here and here.
You can add a Setup project in your solution inside Visual Studio and then add your other project(s) outputs, or static files to the Setup project as references. The Setup project will then detect your dependencies automatically and each time you do a Rebuild All (or you rebuild/build your Setup project) it will automatically include all the necessary files.
What type of project is it? In many cases, ClickOnce can do the job for you, at nominal effort.
Beyond that - you can usually hook your installer build into your build process; some tools will do this for you.
Installer classes run at the client - so I don't think they relate to your build process...
I would flag the files as Content in their respective properties and then in the deployment project right click the project, go to File System and then right click the folder, click Add and select Content Files from the dialog box. This should copy the newest files over every time you build the deployment project.

Categories