Outlook Addin MSI installer copies file in C:\ - visual-studio

I've developed an Outlook addin that perfectly works with my outlook. I used our organizational code signing cert and used ClickOnce. Now I want to deploy it on a small group of machines (piloting). I followed this to create an MSI. The problem here is it copies all the files to C:\ with I double click on the setup.msi. But when I run it as an admin, it copies the files in the right location. Below is what I get from the msi log file.
MSI (s) (84:FC) [13:43:15:553]: Ignoring disallowed property TARGETDIR
MSI (s) (84:FC) [13:43:15:964]: PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'C:\'.
What am I doing wrong?

Looks like you need to change the target folder of your installer. Most probably you chose a folder which requires admin privileges for writing.
You may find the Deploy an Office solution by using Windows Installer article helpful.

With Visual Studio Setup Projects the main reason for this is that the installing user does not have admin privileges, as you seem to have discovered. These VS setup projects switch to a per-user non-elevated install when the user is not privileged. Among other things, this means that the install can't create files and folders in restricted locations (the Program Files folders and others) so the install gives you a separate isolated install in C:. The ALLUSERS value in a VS setup project is 2, and as the documentation here says:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa367559(v=vs.85).aspx
you can get a per-user non-elevated install if the user is not privileged. Windows won't let limited users write to restricted locations just because it's an install.

Related

Visual Studio 2013 Installer Projects Extension copying to root folder

I have installed Microsoft Visual Studio 2013 Installer Projects to create a simple installer. When I run the installer however it copies the files to c:\ instead of the proper folder in Program Files (even though it asks for the path).
This seems to be caused by the fact that the MSI (the only thing produced by the Installer project) is not run with elevated privileges. The other thing is that you cannot say run as administrator for MSI file (unless you do some reg-hacks).
I have searched for a solution and there seem to be loads of more or less complicated ways how to tackle this.
The question is - is there not a simple switch that would allow me just to copy the files to appropriate Program files folder? I do not want to create workarounds for something that seems to be the very basic functionality.
If adjusting the environment (UAC settings, Registry values) is totally not an option for you then maybe you could try one of the following:
The Visual Studio Setup Project produces both an MSI and a setup.exe file. The latter one you can run as administrator by right-clicking on it. No hacks.
Another way of starting a process with elevated privileges is opening a command prompt (cmd) as administrator and then launch your EXE or MSI from the command prompt window.
-
Note: Even though it may not be related to your question, I would also pay attention to the Target Platform. For instance, you cannot install a 64-bit project to the Program Files (x86) folder.

Install files to each users Application Data Folder using Visual Studio Setup project

I have created a visual studio setup project that writes content files to User's Application Data Folder
C:\users\user\AppData\Roaming\CompanyName
I did this By adding User's Application Data Folder in File System on Target Machine link from setup project and adding content files to that folder.
When I install this setup it installs only for one user(active). I want this to install content files to all users AppData folders
Example folder locations:
1.C:\users\user1\AppData\Roaming\CompanyName
2.C:\users\user2\AppData\Roaming\CompanyName
How to install these content files to each and every user's AppData folder on the machine using Visual Studio Setup project.
Any help is greatly appreciated.
The short answer is that you can't. There's no way of enumerating all those folders and installing files to them, and that won't work anyway if a user account gets created after your setup has been installed.
The good news is that it should just work. Assuming your installed app has a shortcut to the program, and the setup was installed for Everyone, log on as another user and use the shortcut. What should happen is that Windows will notice that the user doesn't have the files and it will ask for the original MSI file to install them. This works even if the user account wasn't present at the time of the install, and will happen just once per new user of the app to install the files.

Visual Studio 2010 - create silent MSI for project?

We have an Outlook addin that we created in Visual Studio 2010 in C#. When publishing, we're given an exe that does not allow for any quiet installation processes - none of the typical command switches work.
How do I generate a silent MSI instead of the default setup exe?
Found the solution I was looking for in an MSDN help article.
Deploying an Office Solution by Using Windows Installer
This is all I wanted to do - create an MSI instead of using the provided exe (which does NOT include an integrated MSI or other packages). This allows for flexible, scalable deployments without user interaction, regardless of user that is logged in to the machine.
The short answer is that it just works if you use only the MSI file. The setup.exe installs the prerequisites and then launches the MSI file. There is no good answer I can give about the prerequisites because they may all be different, but in general you just use whatever the details of the redist tell you in docs or a web search, installing prereqs by administrators etc.
It's an MSI, you publish it to the machine (I think that's the group policy description) and in fact the install is required to be silent and will give you an error if you attempt to show UI, the message being "This advertised application will not be installed because it might be unsafe. Contact your administrator to change the installation user interface option of the package to basic."
In other words when the administrator has defined the install parameters etc the user cannot change them.

Update VSTO Word Addin without VSTO auto-update (no rights for installation for users)

I want to update a VSTO addin for word I create without let VSTO automatic update launch. In fact, my end-users have not enough rights for installing.
I only want to update it, not install because first install will be done with vsto installation from VS publish folder with administrator rights.
To update, I copy
MyWordAddIn.dll
MyWordAddin.dll.manifest
from publish folder to appData folder where my addin is installed.
When I launch my word document which is linked with my VSTO file. I have an error
Sorry for french, It said that there's already another version which is installed.
But when I launch it the second, third... time, I have no error.
It appears that you did not disable ClickOnce from automatically installing updates on application startup. That would explain why your application is detecting that there is a new version in the publish folder and attempting to install the update. Then, the error is occurring because you already manually updated the DLL in the appData folder, so when it see's that publish folder contains a DLL with the same version number, it gives the error stating that it's already installed.
You can disable the autoupdate by going into your startup project's settings in VS, clicking the publish tab, and then press the update button and set it to never check for updates.
Just FYI, ClickOnce installations themselves do not require administrative privileges. The prerequisites may, but the installation of the actual ClickOnce app does not. That's why it gets installed under the user profile. So once the user has the prerequisites installed, you can use the automatic updates, unless in your case the user can't even write to his own profile folders.
You could also just run the following command from the command prompt:
rundll32 dfshim CleanOnlineAppCache
You wouldn't need to change any update settings. Any newer versions would update from the specified location when found during the specified update interval.

Why Visual Studio creates .exe installer files?

when I build solutions in Visual Studio, that generates installer files as .exe and .msi, .exe files are useful for what?
The .EXE file that is created by the installer project is a bootstrapper for the .MSI setup file. It is used to launch the .MSI setup file.
Generally, both will launch the setup program and allow the user to install the application. However, sometimes the setup.exe file will run a custom validation routine to determine if the user's computer meets the minimum requirements for installing the software.
For example, if the user does not have Windows Installer, they will not be able to launch the .MSI file, but the .EXE application will still run and inform them that they need to install Windows Installer first. For .NET applications specifically, the .EXE file verifies the presence of the appropriate version of the .NET Framework, and if it is not present, it prompts the user to download and install it.
You can customize the prerequisites that are required for your application in your installer project using Visual Studio. See these MSDN articles for details on how to do that:
http://msdn.microsoft.com/en-us/library/ms165429(v=VS.100).aspx
http://msdn.microsoft.com/en-us/library/7eh4aaa5(v=VS.100).aspx
Others have commented on the how (.exe bootstraps the .msi) but part of the reason why is that users know that .exe files are the things you run. I don't think your average user knows that .msi files are something that you can click on to install an application.
The .exe file is made for installing the prerequisites of your application.
Let's say your application uses the .Net 3.5 framework, you can tell the installer project to include the installation of the needed libraries if they're not already installed.
You may also deactivate it, so only the .msi is being created.
This page shows how to activate and configure the prerequisites setup, just uncheck the checkbox in order to deactivate it.
You also find more details on the process of Bootstrapping on MSDN:
the capability to automatically detect
the existence of components during
installation and install a
predetermined set of prerequisites
.exe files are useful for executing your programs that you've just built in Visual Studio, assuming you're not doing web applications.
Pretty much every Windows program out there is executed using files with an .exe suffix.
Installer exe files are normally just the msi wrapped in a bootstrapper. The bootstrapper can do anything, but normally its purpose is to ensure the user is running a sufficient version of Windows Installer, then extract the msi and invoke msiexec.exe to start installing the msi. Generating installers as exe's is deprecated these days, but some still do it.

Resources