I have found strange issue during execution of installatio file made by VS 2010. The installer should copy some files into App Data of current user. When I run installer on account with admin privileges, everything is ok. Problem appears while installing on guest account. For example I try to install app on guset account A. I must select run as option. I choose user B with admin privileges. After installation all files are copied into folder App Data of user B, not A as I expected... why? Is there any solution for this?
It is called deployment project and it is outdated and broken technology - I suggest using WIX. Those stupid proejcts should hnever have been in Visual Studio - they dont even adhere to the basics how MSI files should work.
One thing you can not nicely control is the elevation request needed for activating admin priviledges. WIX allows you full control over the MSI features.
I must select run as option. I choose user B with admin privileges. After installation all files
are copied into folder App Data of user B, not A as I expected... why?
Ah - logic? You install AS USER B - so surely the files go into User b's folder.
in general you need admin priviledges to install softawre. A gues can not do it. Point. Installation is a tricky high priviledge thing, not something for someone who has no rights on the computer.
The installer should copy some files into App Data of current user.
Invalid per definition. Point. A normal install run should not install anything into a user's app data - what is another user runs the software? The software can make copies when it starts (from shared app data), but a NORMAL install (not a per user install) should never put stuff into the users personal AppData folder. This is a violation of basic MSI principles.
Symantec has a good documentation on the only valid way to do that (and sorry, setup proejcts just dont support advanced features for MSI:
http://www.symantec.com/business/support/index?page=content&id=HOWTO4840
As it reads:
In order to install files to each user's profile, a self-repair of the application must occur.
WIX has similar answers in a post:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/installing-files-to-user-s-application-data-folder-td5377311.html
I assume you don'd o a per user install ;)
I also assume you don't set the registry key according to ICE38 (setup warning):
http://msdn.microsoft.com/en-us/library/aa368961%28VS.85%29.aspx
In general: DO NOT DO IT. User AppData can / should happen when the user starts the app.
Related
I have a C# Windows Forms project that I created.
When i click "Publish" it deploys this click-once application that is only for a single user. If I run the install on my admin account, then there is a shortcut in my AppData that i can click on to run my program. If I try copying that shortcut to C:\users\Public what happens is that another click-once application gets placed on the users' desktop. That user then has to run the install and is annoying cause If i have an update, each user has to uninstall and reinstall the new application. Is there any way to configure VS 2015 to publish in a way that creates an "regular" install for all users?
RobinDotNet addressed that in a blog post a while back:
Doing an all-users install is counter to the design goals of ClickOnce deployment, so I think it’s going to be something everyone has to live with, at least for now. Using XCopy or a setup & deployment package and rolling your own incremental update methodology would be the way to go if you absolutely have to have an All Users installation
https://robindotnet.wordpress.com/2009/09/07/installing-a-clickonce-application-for-all-users/
There are more alternative deployment methods listed in this SO answer that might work for you.
You can not do this using ClickOnce. You may want to install Windows Installer XML to create regular MSI installers. It nowadays integrates with Visual Studio.
As others have pointed out CO is per user. There is no install for all users on the machine option.
However I feel you are either misinformed or badly misconfigured something regarding the implications when it comes to upgrades. Click Once upgrades don't require the user to uninstall, download, and install a new version. That wouldn't exactly be click ONCE.
You can configure your ClickOnce app to automatically detect, fetch, and apply upgrades as you make them available. This can be done either in code so you can control it programmatically or by configuration (i.e. check for updates every time the application starts).
So yes each user would need to install the application once but that would be the end of their involvement.
I have created a windows forms application does some function. The problem is when I deploy the application:
If i deploy with ClickOnce then everything works fine. After installation the winforms application runs without asking for admin password.
If i deploy with Visual Studio Setup Project and create a MSI setup then after installing it requires administrator password every time it runs.
I want to deploy using Visual Studio Setup Project(MSI) , but don't want the software asking for elevated privileges.
The MSI installation does not ask for a password but the installed program does.
you need to work with
UAC elevated permission
. take a look at this Ms Documentation link
Also this project doing some R&D with UAC example
Hope this Helps
Basically you need to edit (or add, if you don't have one yet) an app.manifest file, then use the requestedExecutionLevel to order what is the execution context required.
Read more about it in MSDN
You'll need to create and embed an application manifest (UAC) in your application, as described here. If you don't want to do that, ClickOnce might be a solution.
MSDN has some useful information on this topic, specifically:
Impact to the user's computer. With Windows Installer deployment, applications often rely on shared components, with the potential for
versioning conflicts; with ClickOnce deployment, each application is
self-contained and cannot interfere with other applications.
Security permissions. Windows Installer deployment requires
administrative permissions and allows only limited user installation;
ClickOnce deployment enables non-administrative users to install and
grants only those Code Access Security permissions necessary for the
application.
MSI Installer can be installed PerUser or PerMachine.
I'd like to detect before the new version installation: was previous version installed PerUser or PerMachine?
If PerMachine do nothing because Installer will remove the previous version and install the new one, ok.
If PerUser then check: was it installed user which is the current user?
If current user==user who installed then suggest to user switch installation to PerUser and continue.
Else give message "User 'other_user' need to uninstall manually etc".
The question is: how I can check in c# the user name who installed the current version of product?
Oleg,
Based on other questions you've asked I understand the jam that you are in. It's unfortunate but there isn't much you can do. You could wrap the MSI in a bootstrapper (EXE) to remove any existing Per-User installation for the person logged in ( assuming it wasn't pushed to the machine using the SYSTEM account ) but that wouldn't handle a situation where some other user profile had installed the app.
Here is about the best thing I can think of for your situation. Create your new installer to install to a new directory and new registry keys ( completely different foot print then your old application ). Give this new MSI a fresh UpgradeCode property. Author an active setup registry key to run a cleanup utility the next time a user logs on and then reboot the machine. Put the old UpgradeCode in the Upgrade table just in case you can get lucky for an old per-machine install.
When someone logs in for the first time your EXE will be run. It can then perform MSI API queries to look for old versions of your product and perform an uninstall. In time your old application will be removed.
I recall getting myself into this situations many years ago before I understood the ALLUSERS property. Per-User installations are a pain and only useful for non-privlidged "viral" (as in socially spread) application. It's not a good story for commercial / enterprise applications.
What you want doesn't make sense.
Per-user installations are visible to a single user, you won't be able to retrieve information about the per-user installed apps for user A if you are running as user B. Only per-machine installations are visible for all user.
Take a look here:
http://msdn.microsoft.com/en-us/library/aa369786(v=vs.85).aspx
Note If an application is installed in the per-user installation
context, any major upgrade to the application must also be performed
using the per-user context. If an application is installed in the
per-machine installation context, any major upgrade to the application
must also be performed using the per-machine context. The Windows
Installer will not install major upgrades across installation context.
Now to answer your question... If you are executing an installer per-user and the upgrade installer detects the previous version, that means that the current user installed it.
Can I ask the user WHERE to install the application during install time?
Most setups prompt the user where to install the application, I'm sure you are familiar with it. How can I do this with the visual studio publisher? (If it cannot be done from the VS publisher could you reccommend a program that can do it? Or do I have to do it manually?
As per this MSDN post: "ClickOnce application are installed per user in the user application cache. These applications are managed by the ClickOnce service. If you want to install to a user specifed location such a Program Files... you should use MSI or some other installer technology."
The other deployment methodologies supported by Visual Studio are discussed here
No, you can't. ClickOnce install the application in a user's AppData folder it's not installed like a traditional application. If you want to have more control over stuff like this you need to write your own installer.
Not sure if it is changed, but ClickOnce applications are installed per user in the user application cache. You cant change that location. This means that if 2 different user share the same machine there are 2 different copies of your application.
When I install my C# app in windows 7, UAC always shows. I'm not logged in as Administrator but I want my application to be installed without the UAC.
Can you give me ways on how to do it?
The UAC prompt shows for any number of reasons, none of which is "the code inside the exe calls function X or tries to write to place Y." These include:
the name contains setup, patch, update etc (eg setup21.exe) and there is no manifest
you embedded a manifest that asks for requireAdministrator. You would have done this on purpose in Visual Studio.
there is an external manifest (for NewApp.exe it would be NewApp.exe.manifest) in the same folder that asks for requireAdministrator. You would have done this on purpose too.
you have right-clicked the exe, and on the Properties Compatibility you have chosen to elevate it, or to run as XPSP2 which for 7 also elevates
someone in your company has applied a Group Policy that this installation app should run elevated (unlikely)
you once ran it, got a dialog from Windows saying "that may not have worked right" and agreed to try again with "recommended settings"
Do any of these seem likely? If so, correct them and see if the UAC prompt goes away.
Single Package Authoring link text
You'll want to use Windows Installer / Windows Installer XML to make this install behave the way you request.
If you want to install an app without UAC then you can only touch folders that the currently logged in user can write to. Google Chrome does this--it installs the entire application to the user's local application data folder.
It's very non-standard and I would argue MS should prohibit running code from this location, but it's a working solution to requiring administrator/UAC access to install applications.
Incidentally, Google Chrome more recently made a traditional installer available so one user can install it to be used by all users on the computer.
If you want your application to be installed without triggering the UAC, install to %APPDATA% (instead of installing to %ProgramFiles%) and write to the HKCU hive only in the registry (i.e. don't try to write to HKLM, HKCR, etc.)