Choose install path for ClickOnce application during setup - c#

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.

Related

Publish project for all users

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.

Run WinForms application without administrator rights?

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.

Visual Studio 2010 setup project issue

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.

Why do I need an install wizard? How do I create one?

If I create a WPF or WinForms app, I can launch it by its executable in Debug folder. Why do all programs come with an install wizard and how do I create one for my WPF/ WinForms app?
Programs usually come with an installer because it can put the program in a known location, add things to the start menu, add registry keys, etc.
You can create an installer using NSIS.
installers will be run (most of the time) by administrators. This will allow you to modify protected things of the system during setup such as the file system (Program Files folder), registry and install services and such.
The actual program then will not need these privileges and can be run by non-admins.
Also: Microsoft Logo requirements make the use of Windows Installer (the service that installs MSIs and adds them to your control panel for easy removal) mandatory.
While deploying a windows based application to a client machine we need to take care about several aspects like installation location,Registry values and to ensure that the required version of .Net framework is present in the client machine.Such kinds of things can be automated using an installer.You can create an installer by using the setup and deployment project or using clickonce
Check the below links for more
Setup and Deployment Projects
Deploying a WPF Application (WPF)
Deploying a Standard WPF Application Using ClickOnce and Visual Studio
WPF 3.5 SP1 Deployment
For example, almost any program produced by Visual Studio 2010, if copied to a freshly installed Windows XP system, will fail to run. This is what installers do well that is hard to get right: dependencies.

Install application in window 7 without UAC using C#

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.)

Categories

Resources