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.
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 develop a web application on Microsoft .Net 4 and Entity Framework 5. When I upload the project on my web farm it doesn't work. I believe that Entity Framework is not installed on my web farm. So I contacted my host to support this particular issue.
They said:
Send us a download and installation instructions, with any
requirements to install Entity Framework.
Except we utilize a link from directly within Visual Studio through Nuget.
How do you load the proper deployment information onto a server, since you can't directly deploy with Nuget since they don't have Visual Studio installed?
Server Information:
Windows Server 2008 R2 64 Bit
Nuget link I used to install Entity Framework.
If possible please guide me or reference a place where I can solve this deployment issue. Any help would be greatly appreciated. Thank you for your assistance.
In order to successfully launch your project on a deployment server you should ensure that your application has a Deployment Package to be installed on the server.
Deployment Considerations can be found here:
You have a lot of things you need to consider, but Entity Framework does have a lot of choices and flexibility. Some of your choices:
Click Once Security and Deployment
Windows Installer Deployment
What Is a ClickOnce Application?
A ClickOnce application is any Windows Presentation Foundation
(.xbap), Windows Forms (.exe), console application (.exe), or Office
solution (.dll) published using ClickOnce technology. You can publish
a ClickOnce application in three different ways: from a Web page, from
a network file share, or from media such as a CD-ROM. A ClickOnce
application can be installed on an end user's computer and run locally
even when the computer is offline, or it can be run in an online-only
mode without permanently installing anything on the end user's
computer. For more information, see Choosing a ClickOnce Deployment
Strategy.
ClickOnce applications can be self-updating; they can check for newer
versions as they become available and automatically replace any
updated files. The developer can specify the update behavior; a
network administrator can also control update strategies, for example,
marking an update as mandatory. Updates can also be rolled back to an
earlier version by the end user or by an administrator. For more
information, see Choosing a ClickOnce Update Strategy.
Because ClickOnce applications are isolated, installing or running a
ClickOnce application cannot break existing applications. ClickOnce
applications are self-contained; each ClickOnce application is
installed to and run from a secure per-user, per-application cache.
ClickOnce applications run in the Internet or Intranet security zones.
If necessary, the application can request elevated security
permissions. For more information, see Securing ClickOnce
Applications.
How does a Windows Installer Deployment work?
Windows Installer
deployment enables you to create installer packages to be distributed
to users; the user runs the setup file and steps through a wizard to
install the application. This is accomplished by adding a Setup
project to your solution. When built, the project creates a setup file
that you distribute to users; the user runs the setup file and steps
through a wizard to install the application.
That is a brief description of a few ways, you can find examples here: Once you actually have your host load your deployment package it should run without any issues. Hopefully this points you in the correct direction.
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.
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.
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.)