I have published a console application and produced 3 items :
Application Files
Application
setup.exe
First off, am I correct in saying I can run the application directly from here without installing ? And will this use the config settings from the application files directory ?
Second, if I run the setup.exe, I don't have the ability to choose the install location. Is it possible to set this up ?
This deployment technology is called ClickOnce. You can read more about it and how it works on MSDN: https://msdn.microsoft.com/en-us/library/t71a733d.aspx
First off, am I correct in saying I can run the application directly from here without installing ?
The application is indeed installed when you run setup.exe or *.application.
And will this use the config settings from the application files directory ?
Yes. The running application will use the config file in the folder of the current version of the application.
Second, if I run the setup.exe, I don't have the ability to choose the install location. Is it possible to set this up ?
No. You can't change the installation folder when you use ClickOnce. A ClickOnce application is always installed per user in the user application cache (C:\Users\username\AppData\Local\Apps\2.0).
Related
I had created a windows form application and used setup project to create installer. But after installing my application the application is not opening from the location it is installed("c:\Programs Files(86x)\"). But the application runs fine if i copy the entire installed files to another drive. Actually my application is creating some folder inside the installed directory when running. so i thought it is some problem related to windows permissions. I had set app privileges as "requireAdministrator" and still not working. Can anyone help me with a solution?
Actually my application is creating some folder inside the installed directory when running.
Don't do that!
The Program Files folder is read only to standard users, and has been since Windows 2000. And since Windows Vista even Administrator users will require elevation to get write access into this folder.
Use the All Users Application Data folder instead (Environment.SpecialFolder.CommonApplicationData).
The alternative is an advanced installer product (meaning purchasing the full version of InstallShield or similar rather than the version included with Visual Studio) which supports adding an action to your install process that both creates the folder and sets new permissions, and does this at install time. But that's really a cheat, anyway. Just use Application Data.
When execution an application for the first time, I want this running applicationto be copied to C:\Program Files\
Say I give this application to my friend then he executes it for the first time and this application must do the copy to C:\Program Files\
How to code it?
You are trying to create a Click Once kind of application. Check the link Click Once Deplyment
You cannot move an EXE file while it is being executed, you will either:
have code that copies the EXE to another location
IO.File.Copy()
or have an installer
Click Once installs to a really obsecure location, not program files. It does NOT require admin.
If you add a MSI setup project to your solution you can see this answer to hardcode the install path to C:\Program Files\
If you choose the MSI solution you will need Admin to install. Because the setup.exe is responsible for the downloading/installing components (such as dotnet) it requires Admin to be executed.
If you know the PC your application is going to be installed on already has the .Net Framework & etc then the easiest way to avoid the UAC prompt is to run the MSI not the setup.exe. Running the MSI wont ask for admin.
You can also follow this answer to make your upgrades install to the same folder.
I created a c# windows application and deployed it by clicking publish(clickonce). now 2 setup files and a Application folder are generated. when the setup file is installed in one system in which it was created, it is working properly. but when i copy the files to another system and install, when i run the icon nothing happens. what to do?also how to add mdf or ldf files to the setup file?
The idea with publishing a ClickOnce application is not to copy it elsewhere afterwards but to execute the installer from the publish location.
Otherwise you'll need to change the app location in the manifest using MageUI for instance.
I'm a web developer building my first production grade console application (C# .NET 4.0). I have a question about creating a settings file that the user can edit before running the console app (to customize output folder paths, etc).
I'm a little confused -- when I publish my console application and install it (by clicking on on the generated setup.exe file in my target publish folder), all I get is an entry to my start menu. Nothing gets installed to C:\Windows\Programs, and there doesn't seem to be anywhere else on my system that files get installed to. Essentially, I'm just trying to find the app.config xml file so that I can edit it after the program has been installed. (btw, when I click on the start menu entry, the program executes properly).
Is what I'm trying to do possible?
For a clickonce deployment, the files will be installed under the profile of the user who installed the application (by default).
For windows XP this should be:
C:\Documents and Settings\username\LocalSettings\Apps...
For Windows 7 (and Vista?) this should be:
C:\users\username\AppData\Local\Apps...
An installation program for your software is a separate piece of software.
You can definitely make one but when you compile your console app it doesn't create an installation executable. It just makes it's own executable. You can copy that executable alone and run it. If you need more resources to go along with it and therefore decide you want an installation program, you have lots of options.
The two that spring to mind in this case though, are setting your project to use "ClickOnce" from the project properties, or adding a "Setup and Deployment" project to your solution from the "Other project types" section of the add project dialog box.
VS 2008 SP1
I have created a application that I have installed on the user computer. However, I want the application to be self-updating. But I am not sure if this would really update the application.
The application will download all the files from the web server, and replace the files in the directory where the program as been installed to. The user will restart the application.
I am just want to be sure, because I can't replace the installed files with the updated ones. As the application will be running. So really the application cannot delete/replace itself.
So, I was thinking that I could download into another directory, if the program is installed in this directory 'program files/application/1.0.0' then I could download the files to 'program files/application/1.0.1'.
However, when the program restarts, how can it know that it has to execute from the 1.0.1 directory?
I can't use clickonce or the updater block for this.
Many thanks for any advice,
A good option is to make an independant Updater application.
The updater will download the newest version and kill/replace the old.
I think this is the best option, because you can execute the updater within the main appication (so you can say that it´s self-updating), or directly by the user with a shortcut.
The updater can check if the application is running and ask the user to exit the application or kill it by itself.
Forgive my english...
Good luck
All of that is already done for you if you use ClickOnce deployment (Project properties, Publish).
You can wrap the application with a small loader program which will do a version check. If it's out of date, download the newer binaries and overwrite the old ones. If you want to maintain all version you might end up with:
c:\program files\mycompany\myapp\loader (the newer version will point to the latest directory)
c:\program files\mycompany\myapp\v1.0
c:\program files\mycompany\myapp\v1.1
If it's on a LAN, you might be able afford the bandwidth of just re-downloading the binaries on start up instead.
Use Windows Installer for the installation and updating. If you sign your installation packages the user can update your application without needing any administrator privileges.
I've made a website and an application that demonstrates the functionality of what you want on my website.
Wix Clickthrough might meet your needs: http://wix.sourceforge.net/clickthrough.html
I would look into ClickOnce. It can be configured multiple ways, to check for updates before the application runs, to download from the server each time it's run, or check for updates after the application has started.
I have done ClickOnce Deployment and an independent updating application, they both work well. You obviously will have more flexibility over an updating application that you create yourself, however tho, ClickOnce can also be configured to install prerequisites such as the .NET Framework, Windows Installer, etc... for your application to run.