Add common Startup Folder to VS2008 Setup Solution - c#

When you right click the File System on Target Machine tree and select Add Special Folder inside a setup application you get a list of options. One is User's Startup Folder....however there is no option for Common/All Startup Folder. Is there a way to specify the common/all startup folder as a custom folder and still have it work properly in XP, Vista, and Win7?

Select the Deployment Project Properties and set the InstallAllUsers option to True.

Here is a little microsoft walk-through:
http://msdn.microsoft.com/en-US/library/716bxh4e(v=vs.80).aspx
You will also need to set the InstallAllUsers to TRUE and replace the '[TempFolder]' from the example with '[StartupFolder]'

Related

Windows Installer Visual Studio Setup Project

How can I change DefaultLocation value of the Application Folder (or Custom Folder) in code?
I can define DefaultLocatio as [MY_DEFAULT] on the File System in Visual Studio, add to CustomActionData /myDefault=[MY_DEFAULT] and pass MY_DEFAULT as parameter to the msi file.
In code I can read it as Context.Parameters["myDefault"]. This works.
But how can i change in code the value of the DefaultLocation where the application will be installed?
Right-click your Installer project, go to View->File System.
Now right-click on the 'Application Folder' and select 'Properties Window'. In the Properties Window you can edit the DefaultLocation field (see screenshot below).
By default, the DefaultLocation is [ProgramFilesFolder][Manufacturer]\[ProductName] but you can change it to anything you like - C:\MyApp\ or [ProgramFilesFolder]MyApp\ or whatever.
Good Luck.

How to implement Setup and Deployment project with Custom Actions

My Setup and Deployment project will copy both MyClient.exe, MyClient.Config files to the appropriate directories using the Setup.msi file.
I am trying to enhance the Setup.msi project so that user can enter the configuration values at run time and the setup program can update the file MyClient.Config. I have created a new project and added a windows Form in it with edit boxes. The project will create an application named Helper.exe
I followed the below link and implemented the Custom Actions functionality.
link
But the issue is Setup.msi is always starting the MyClient.exe instead of Helper.exe during the deployment.
Thanks in advance for your help
I'd suggest either using a different tool (this project type is removed from VS2012 and exposes very little of Windows Installer) or move the requirement from the installer to the application (first run configuration).

"User's Application Data Folder"; Is it possible to force between SpecialFolder.ApplicationData and SpecialFolder.LocalApplicationData

I have an application that needs to run at normal privileges. So it gets installed in Environment.SpecialFolder.ProgramFiles, but stores conf/logging/history details in Environment.SpecialFolder.LocalApplicationData.
The problem is that in the Setup/Deploy project, in the File System section I don't get to distinguish between ApplicationData (roaming) or LocalApplicationData, only "User's Application Data Folder," which could be either depending who installs it on what machine.
Is it possible to force "User's Application Data" to be one or the other?
MSI does support local application data folder. If you're talking about a Setup and Deployment project, maybe switching to another installer framework like WiX might be in order. (Setup and Deployment no longer exists in Visual Studio 2012 anyway). WiX has a tool called Dark that will convert an MSI to WiX XML files so you can simply edit them or add to them quickly and easily.
The Setup Project has made a comeback in visual Studio 2015.
The following works with VS 2015:
In file system view, add a special folder of type 'Custom'.
In the properties of this folder, set the following values:
Name : Local App data folder
AlwaysCreate : True
Condition : (leave empty)
DefaultLocation : [LocalAppDataFolder]
Property : SOMEPROPERTYNAME
The magic happen thanks to DefaultLocation property value: [LocalAppDataFolder].
I suppose any system folder variable as defined in the following link should work:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370905(v=vs.85).aspx#system_folder_properties

Install shortcut from VS.NET MSI installer project for ALL USERS

I've searched and searched on here. I've tried the following methods with no luck:
Set the project installer properites to - InstallforAllUsers (can't remember the exact name) but that does add the shortcut to all the user's menus, but only the user that installed the application is able to run it. The other users get a SysWOW64 error about not being able to install it or something.
Set the [DesktopFolder] or [AllUserStartMenu] again, I may not have these property names right, but I followed them from a few users that have posted on here. Giving these properties the value of ALLUSERS. The installer fails during install and says "Unable to locate network location 1" or something like that.
Used ORCA to edit the MSI file and add a property to install for all users, and failed inside ORCA with the error of unable to add property.
It's maddening. I'm using Visual Studio 2010. I think I'm just pushing the limits of the instller.. imagine that. My install is a desktop application (winforms) that has a custom installer action and class that writes some values to a setting file on choices the user makes during the install (custom UI installer screen).
Any ideas?
MSDN Site that explains how to do this
MSI Install All Users
The InstallAllUsers property for a deployment project determines
whether an application is installed for all users of a computer or only
for the user performing the installation. The InstallAllUsers property
can be set in the Properties window when a deployment project is
selected in the Solution Explorer.
Settings
False - The application will only be installed for the current user
and will not be visible to other users of the computer (the default).
True - The application will be installed for all users.
InstallAllUsersVisible Property
The InstallAllUsersVisible property for the Installation Folder user
interface dialog box determines whether the Install MyApplication for
yourself, or for anyone who uses this computer label and corresponding
Everyone and Just me option buttons appear during installation. The
InstallAllUsersVisible can be set in the Properties window when the
Installation Folder node is selected in the User Interface editor.
Settings
True - The Install MyApplication for yourself, or for anyone who uses
this computer label and corresponding Everyone and Just me option
buttons will be shown during installation, and the user's choice
determines the installation method.
False - The Install MyApplication for yourself, or for anyone who
uses this computer label and corresponding Everyone and Just me option
buttons will not be visible during installation."
===========================================================
So here's Step-by-step what you do to install for Everyone as default
without the radio button choices appearing for your users who are
installing your product.:
1. Click on your setup project in your Solution Explorer.
2. Look in the Properties window and set the property InstallAllUsers
to be True
3. Click on the icon in the Solution Explorer toolbar that has the
pop-up tooltip "User Interface Editor"
4. Click on the "Installation Folder" item in the panel that appears.
5. Look in the Properties window and set the InstallAllUsersVisible to
be False.
6. Rebuild your solution.
Some other additional notes to try from a quick search I have just done for you..
I was searching the web for an answer to this question, and I found the answer hidden away on Microsoft's site.
You are going to need Orca.exe from Microsoft. It is an MSI database editor. (http://msdn.microsoft.com/library/de...p/orca_exe.asp) The only way I see to get this file is by installing the Windows Installer SDK (http://www.microsoft.com/msdownload/...msdk/sdkupdate).
Once you are done building your .MSI file, you will need to open it with Orca.exe. Once open, go to the "Property" table. From the menu, Click "Tables" and then "Add Row". For the "Property" string, enter "ALLUSERS", for the value, enter "1" or "2". Entering a "1" will cause the installer to try to add the shortcut to "All Users" and fail if the current user does not have authority, a "2" will cause the installer to try "All Users" first, then fail over to their personal folder. For details - http://msdn.microsoft.com/library/de...stallation.asp
I tested this on "User's Desktop" and "User's Start Menu" and it worked for both. A word of warning: If you re-build your MSI file, it will delete the "ALLUSERS" property entry, so you must use Orca.exe and re-add the setting on each re-build.
I know this is an ancient question, but I've done this before and when I recently had to do it again I had forgotten how. Since my gut instinct was to look on SO before digging into old installer projects, I figured I'd better get the answer posted.
Here is how I accomplish this:
Add a registry search to your launch conditions:
(Name): Search for All Users Programs menu
Property: ALLUSERSMENU
RegKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Root: vsdrrHKLM
Value: Common Programs
Create a new target folder in the file system editor and leverage your new property:
(Name): All Users Programs Menu
AlwaysCreate: True
DefaultLocation: [ALLUSERSMENU]\YourMenuHere
Property: MENULOCATION
Transitive: False
Place your shortcuts in that new folder.
That's it.
For reference here are the folder paths you can access in the registry for Windows XP:
and for Windows 7:
See ALLUSERS property on MSDN. The link in the first comment is broken.
http://msdn.microsoft.com/en-us/library/aa367559%28v=vs.85%29.aspx

How to force deployment project to update files during installation of newer version?

I have a Deployment Project for my VS2008 C# application. When installing a new version of my application I want to make sure that files are updated with the files contained in the installer.
I want my installer to automatically remove any old version of the installed application. To do that I follow this procedure (also described here):
Set RemovePreviousVersions to True
Set DetectNewerInstalledVersion to
True
Increment the Version of the
installer
Choose Yes to change the ProductCode
For the assemblies I make sure the AssemblyVersion is set to a higher version:
[assembly: AssemblyVersion("1.0.*")]
Everything is working as intended except for my configuration files (xml files). Since I cannot find a way to "version" these files I cannot make sure that the files are updated if they have been modified on the target machine.
Is there any way to do this and how?
UPDATE: I have tried the approach/solution/workaround found here
Include the file directly in a
project with the following
properties: "Build Action -> Content
file" and "Copy to Output Directory
-> Copy always"
Then add it to the deployment
project via Project
Output->Database->Content Files
Unfortunately it did not make any difference. The behavior is exactly the same.
Add the following property to the Property table of the MSI:
Property REINSTALLMODE with Value amus
Note: This will cause all the files in the MSI (versioned and nonversioned) to overwrite the files that are on the system.
If you're willing to use Orca (there may be another way to do this method, but it's the only one I know of) you may be able to set up RemoveFile directives.
See here for a typically light-weight MSDN document -- could be a starting point.
http://msdn.microsoft.com/en-us/library/aa371201.aspx
Alternatively you could always create a very simple bootstrapper executable that simply calls "msiexec /i REINSTALLMODE=oums" (or whichever command-line switches are needed). Call it setup.exe if you like...
Better option long-term may be to switch to InstallShield or similar -- VS2010 includes a light version of IS and I believe they're moving away from vdproj projects.
Have you tried the approach/solution/workaround found here?
Include the file directly in a
project with the following
properties: "Build Action -> Content
file" and "Copy to Output Directory
-> Copy always"
Then add it to the deployment
project via Project
Output->Database->Content Files
I may be incorrect here, and therefore I am exposing myself to down votes, but here goes anyway!
I believe it is on purpose that config files do not automatically get overwritten; the principle there being that you would not normally want your application's configuration overwritten when you install the new version of the program... at least not without numerous warnings and/or chances to merge configuration first.
Having your application configuration get overwritten by an updated version of a program could make for a very upset end user (in this case, web site admin).
Further, I know that sometimes, the developer may be the person doing the deployment. In such a case, this behavior might not seem so logical when deploying a single site to a single server; but when roles are split and/or you have multiple servers with different configurations, this can be a life saver.
You need to include the new version of your files in your custom installer and manually install these file during Custom Install routine is called
This must be applied to any file that does not have version that can be tracked by the installer.

Categories

Resources