Install Clickonce Programmatically Open
When.Net 2.0 launched several years ago, developers got a brand new technology baked into the framework that allowed WinForm applications to be deployed similar to a Web application. The technology was called. ClickOnce has seen a few enhancements since it’s initial release such as the ability to add a desktop icon when an application is installed along with better support for ISVs.
- Clickonce Application Reference Appref Ms Run As Administrator
- Clickonce Install Location Windows 10
- Clickonce With Parameters
One feature still missing from ClickOnce is to make an application start automatically after login. Let’s solve this problem. The ProblemWhen a ClickOnce application is installed the user doesn’t know the directory location it is installed in on their computer. Honestly they shouldn’t care. Not only does the user not know, but the developer doesn’t know either!
ClickOnce applications are installed in random directories on each computer in a hidden folder within the user account called the “AppData” folder. For example, here is a screen shot where the ClickOnce version of that I publish on this site is installed on my newly built machine.As you can see it is in a random place and this is the problem because a ClickOnce application doesn’t have a fixed path like c:program filessomewheremyapp.exe. Well, because the ClickOnce team at Microsoft didn’t build in the ability for Developers to specify a location as to where the application is installed, nor can the user select one. The purpose of a ClickOnce app is the end-user clicks a URL that ends in.application and the application installs. Simple, quick, easy.
If the application path was set outside of the user’s account it would require escalated permissions. A feature of ClickOnce is it allows the user to install an application without administrative permissions on the computer (great for internal apps at companies for example). Since the ClickOnce apps are installed in the user’s local directory and randomized as to their whereabouts, we can’t place a shortcut URL in the startup folder that points to the executable.Now some of you might be thinking that a Developer can programmatically figure out the location of the executable and place the shortcut in the Startup folder within the menu, thereby allowing the application to start. That would be the wrong thing to do.
The reason is ClickOnce applications version themselves as they are installed. If you took this approach, the next time the application was updated, a new version would be installed and the old version still remains. Essentially there are two versions on the machine (this is a feature because it allows end-users to roll back to the previous version if they want to in case the latest version of the application is broke). As you see, creating a shortcut programmatically and placing it in the startup folder on the machine won’t work because it is constantly changing locations. The SolutionThe solution to the problem is actually really simple.
So simple in fact it escapes most.Remember that a ClickOnce application is launched from a URL ending in.application. For example, the Witty Twitter application I publish has a URL like the following:The.application extension is something your computer knows how to process after the.Net framework gets installed.What most developers do is they open up the folder the location where the ClickOnce application installed the shortcut to view the shortcut in notepad.
Here’s an example using Witty:If we view the Witty shortcut in Notepad it looks like this:The first thing you’ll notice is the extension of this shortcut is different, it ends with.appref-ms. So what happens is developers copy this file to the startup folder, but then it doesn’t work in all cases.
It will work on some versions of Windows but not others.Here’s the fix. Right click on your desktop and in the menu create a new shortcut.Next, enter the URL of your application. Here’s a sample using Witty:Click next and give it a name:After saved, open the shortcut in notepad and remove everything but the first two lines. You should have something like this left when you get done:InternetShortcutURL=you have your shortcut.
Clickonce Application Reference Appref Ms Run As Administrator
Wait, that’s just a standard Internet Shortcut? That’s all you need since the application is launched from a URL anyway. You’ll notice after doing this the new shortcut is showing the default browser’s icon (not your application icon), this is perfectly ok. Now that you have your file, simply drag and drop the shortcut into the Startup folder. The next time the computer boots, the application will automatically launch.If you are a developer you are home free now because programmatically writing a file to the user’s Startup folder with this information is simple. In your application you can place a menu option to start the application on startup or not.Their are two downsides using the method I can think of.
One, your application shows the default browser’s icon. Secondly, when the computer launches the browser will open for a split second to launch the application but then it closes (at least that’s been our experience).
IntroductionThis article presents quick and clear steps for the click once deployment techniques for the Infrastructure and Developer/Deployment Team. It covers the web server setup, directory structure, file share and permission tips on the deployment server and basic steps for the developers to deploy and general troubleshooting.ClickOnce is simple to configure and use without leaving the Visual Studio environment. It is easy to deploy the windows based client application using the interactive tool. The application can be distributed to install and to receive updates in the forms of URL, URI and CD media.ClickOnce is definitely an advantage over the previous generation of Install and Updater tools provided by Microsoft. There is no need to add a setup/MSI project or struggle with the manifest tool by Application Updater Block anymore.Upon the install, it creates a shortcut under Programs-CompanyName-Product directory. The user should also be able to Remove or Repair the application using Windows 'Add or Remove Program' utility. Deployment Web Server SetupIn this example, the deployment server is ' MyAppUpdater'.
It has limited access to all the users but it has shared directory with permissions to the developers as, to host the deployment files.There is no need to create the subdirectory or browse to the directory. ClickOnce from the VS2005 IDE creates them automatically for us. Follow the steps below for a quick guide to the deployment.
Ganesh KP 23-Mar-17 4:1323-Mar-17 4:13Hi,I have followed the steps mentioned in the article and I could able to install in my machine. Prasanta Bhowmik 10-Jan-11 0:5510-Jan-11 0:55Hi Preeti,I have a windows forms which i have deployed using click once technology. But initially when we build the solution with set as 'Any CPU', but its only ran on 32 bit operating system not on 64bit.So now we have build the solution as 'x86' which support the 32 and 64 bit both the versions.So when users trying to upgrade from the previous version to new version they got the error as 'The deployment identity does not match the subscription.' Coz we have changed the platform target from 'Any CPU' to 'x86'.So is there any way we can sort this out.Thanks,PrasantaUK. Cocis48 21-Jul-09 8:1421-Jul-09 8:14My application solution has a windows project and a web service project.
I did click once and deploy to a share hosting company. When I install the application on a client and try to use a option that uses the web service I got a message like this: 'The communication object, SystemModel.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state'. If I try in my development machine it works fine. Any suggestions?thanksOscar.
Clickonce Install Location Windows 10
As suggested, you can set the files to be embedded and they should be picked up as DLLs. Alternatively, you could try my software. ClickOnceMore is a ClickOnce tool designed to make life easier if you're doing a slightly more complicated ClickOnce deployment. Check it out at.Within the software, using the File Inclusion Rules you'll be able to pick up all DLLs in any given directoy and include them in your ClickOnce manifests. They'll automatically be included as DLLs so no need to worry about embedded resources.If you are doing odd things with ClickOnce, then ClickOnceMore is worth a look.Regards,Greg JackmanRed Sky Software.
Kiquenet.com 6-Sep-08 2:396-Sep-08 2:39Hi all,I am working on a windows forms app. I do my development in a development environment, and I have certain settings in my app.config like connection WCF that point to my development WCF services.When I deploy my Application with ClickOnce, those settings are going to have to be updated to their production values. What is the recommended method for managing this? I can't imagine modifying the app.config on production and then having to start over again with the development values the next time i publish.Thanks in advanced. Please, any help will be grateful.
Gabriel X 20-Dec-07 9:0120-Dec-07 9:01Hello friend,As an amateur programmer, I am dealing with my softwares' deployment. You know, today a lot of softwares are being developed, without any dependency of.netframework. Surely people don't like to see an error while running a software, which says: '.netframework.v2 needed!' So, I have to find a way to make my software.netframework-independent. Current dependencies are: 'system.windows.forms', 'system.drawing' and 'system'.
If there is any solution for my problem at all, please share, I'll be grateful! Neal Sualog 29-Jul-Jul-07 18:39I don't encounter any problem on publishing the project to the webserver but when i tried to install it from the website(publish.htm) setting up the application on my local computer fails. What seems to be the problem?
Clickonce With Parameters
Do i have to make any additional configuration on the apache webserver? Preeti Baranga 10-Jan-Jan-07 19:41Ref (Troubleshooting #2)Setting up IIS to allow downloading.config file could be risky considering this is the file which holds database connection strings and other settings. To minimise the risk of getting burnt deployment team needs to work closely with the IT/Infrastructure to setup the website and limit the access to the machine. The connection string to database and other sensitive information should always be encrypted in the config file or any other manifest files, regardless it is clickonce deployment, setup using msi or any other kind of distribution. The deployment website can be limited to internal network only not public access.
Deployment website should not host other public facing public website. Installation to public can be through the CD installation, could minimise the risk.Preeti.
CliffStanford wrote:For ClickOnce to work, not only must the user be using Internet Explorer but he must have set it as his default browser.If he is using Firefox or another browser, the download will fail.Problem with deploying.application file is not a browser problem but it is the security constraint on IIS. IIS would not let.deploy,.config or.application files download for security reason. The deployment team needes to set appropriate MIME TYPE for the deployment website to allow these files as described in this article under troubleshooting. I do not have any problem to install using IE or Firefox web browser.Though setting up IIS to allow downloading.config file could be risky considering this is the file which holds database connection strings and other settings.
To minimise the risk of getting burnt deployment team needs to work closely with the IT/Infrastructure to setup the website and limit the access to the machine. The deployment website can be limited to internal network only not public access. Deployment website should not host other public facing public website. Installation to public can be through the CD installation, could minimise the risk.Preeti.