Pushing updates to a application built in Visual Studio - visual-studio-2010

I am considering building an application in Visual Studio 2010. This application will be distributed to dozens of users. As time passes, I will have to update the application. Is there a way that I can push updates to the users without having to rebuild the application, re-distribute the application to the users, have the users uninstall the original application, then install the new version?
I imagine the solution as the user being notified of a new version upon start-up, and the user clicking "OK" (or some equivalent) and then the program will download the new version.
Is there a way to do this in Visual Studio?
Thanks!

ClickOnce is an option, but not necessarily the most popular. You can also roll-your-own solution, which really isn't that hard:
Create a URL on a web server which returns the latest version (as a JSON object, XML string, plain text, whatever).
Have your program query this URL at startup.
If the latest version doesn't match the current version, prompt the user and download the latest version from the web server, saving it to a temporary directory.
Invoke the downloaded installer. (If it's an msi, there are command line options for "silent install" without a user interface; other installer have similar features.)
This approach has nothing to do with Visual Studio and could be used with any language / IDE.

I think you are looking for ClickOnce.
Apps automatically download the latest version of themselves.
ClickOnce takes the advantage of the Background Intelligent Transfer Service (BITS).
Trustworthy deployment model for users to be able to download and execute applications from centrally managed servers without requiring administrator privileges on the client machine.
Updates are transacted in a single transcation. (See this to understand “Single Transaction”)
The application not only can work offline but it has a degree of control over it; APIs exist, so that the application can find out if it’s online or offline; it can also control its own update process;
ClickOnce is integrated with Visual Studio .NET, including the ability to generate the appropriate extra files and tools that help to figure out which security privileges your application need in order to run.
Application files can be downloaded on demand or in batches.
ClickOnce comes with a Win32 “bootstraper” executable that can download necessary components, even the .NET Framework itself.

Related

Run a condition check after user selects installation folder

I have created a winforms app and a setup and deployment project for that app (VS 2010).
All I need is this:
When a user runs the msi, right after he selects the installation folder I want to check if the main executable of the application already exists in that folder. In that case I want to break the installation and prompt the user to either uninstall the existing application or choose a different folder.
I would like, if possible, to not use any custom installer action. At first, a launch condition (with a file search) seemed to be the right way, but it seems launch conditions (since they are 'launch') run at the beginning of the msi execution and not after folder picking.
Visual Studio Setup and Deployment Projects don't support this type of authoring. It's one of the many reasons that Microsoft removed that project type from Visual Studio 2012.
The only way to do it using this tool would be to build an MSI and then use ORCA to create a transform authoring the validation custom action and scheduling it into the UI as a gating control event. You could then write a postbuild script to apply the transform to the MSI every time it gets built.
Very advanced stuff and frankly not worth the effort. It would be far more beneficial to switch to a tool that supports doing this such as Windows Installer XML (FOSS) or InstallShield 2012 Professional. ($$)

Creating a standalone .exe for a windows application in visual studio 2008?

I have created a windows based application in C# using visual studio 2008 which basically scans for the registry and then fixes the resulting errors. Now using the msi installer i have made a setup and it works fine. However i have met with a new requirement.
Usually after providing the setup to the user/client has to install the setup and when installed, in the installed folder there are lots of .dlls that i had used to create the project. But my requirememt is to create a single standalone .exe using which i wouldnt have to provide my users with the setup file. All i need to do is that using this single .exe file my whole project should execute and perform the same process of scanning and fixing the registry.
I also tried "ClickOnce Deployment in .NET Framework 2.0" and got the error "ClickOnce does not support the request execution level 'requireAdministrator'". and also have gone through the link
"ClickOnce does not support the request execution level 'requireAdministrator.'"
But still i feel that i would be comfortable if i can get a single standalone exe which can execute my windows forms application.
Is there any way to do it?
Any hint with this thing will be really helpful to me.
Thanks in advance
~Viknesh

Attach and configure ms sql server database using installation package

i have some Db steps (attach database, adding and configure a new login, configure roles) and i want to automize it using installation package. Right now in project we are using standard Visual studio installer. Can i implement db steps using standard visual studio intaller (custom actions or something else)? Or maybe i should use some others installers like Install shield, Wix?
As far as I know Visual Studio setup project doesn't offer this functionality out of the box (although, my experience with it is tiny). Also, it is not a good idea to implement it all from scratch in a custom action - it is really the last resort.
Other vendors, at least those you mentioned, do offer this. if you decide to move to one of those, keep in mind the learning curve, which will take some of your time (for WiX is probably more). However, if the VS setup project is quite small and simple, it might be a good idea to move at this point, considering the fact that VS setup project type was deprecated by Microsoft.
For DB configuration you may create SQL script which can be installed with an application or into temp directory and feed it to whatever consumes sql scripts in mssql (in oracle its sqlplus). Not sure about visual studio but that's how I saw in one project for InstallShield.

Suggestions for updating ClickOnce custom prereq

I have a WinForms app I am deploying via ClickOnce. I added a custom prereq in the form of a .msi that installs X509 certificates. Question is, if I need to change certs due to expiration, how do I get ClickOnce to notice the difference in setup versions and run the .msi again? Is this even possible?
No, this isn't possible using ClickOnce. ClickOnce doesn't handle prereqs at all. It simply keeps client files in sync with files on a server.
It's confusing because when you deploy with Visual Studio it lumps prereqs in with ClickOnce so people think ClickOnce handles them. All Visual Studio does is build a small bootstrapper exe that ties all your prereqs together. That way, the user can run a single exe that handles downloading and running all the install packages in the correct order rather than telling your users, "Install the .NET Framework 4.0 (unless you already have it), then go here and download something else and run it, then this..."
If you want to handle this, you'll have to write code in your app's startup to do it. Check if they have the latest version, prompt them to install, send them to a webpage, etc. Not fun, but definitely possible.

Install wizard for my windows form application - or not?

I am wondering about the need for an install wizard for my little Windows Forms application. No database access, just file access on a shared network drive.
I have seen times when an executable is sent in an email, copied to a desktop and used.
Other times when an 'install wizard' seems to be used to set up the application.
What dictates the need for this or not?
And if I want to use one - what needs to be added to my windows form app?
If your application is truly just an .exe file, it's probably okay to distribute it as-is without an installer. This might be preferable for more advanced users, because they won't have to worry about cleaning up a broken/unwanted install - they can just delete the file and be done with it.
On the other hand, most Windows users are used to working with installers, and having shortcuts automatically created on the desktop or Start->Programs. This is where an .msi can really help. Also, using an installer will usually put your application in the "Add or Remove Programs" control panel, which most people know how to use. Also, if your application is more than just a single .exe file (e.g. multiple .dlls and resource files), you'll probably want to use an .msi.
Creating an installer is easy, look at "Setup Projects" in Visual Studio.
An installer is almost always a good idea, because it can work out what dependencies your application has - which you may not even be aware of.
It also looks more professional and users will have more confidence in it.
There's an open source installer called NSIS that's pretty good, if you find the Visual Studio setup wizard too clunky, as I sometimes have.
Sometimes simply copying a file just isn't sufficient, this is when you need a setup program.
Checking if the correct version of .NET is installed
Installing C++ runtime dependencies
Creating a desktop shortcut
Setting up "default" configuration data
Adding exceptions to the Windows Firewall
Preventing installation on unsupported systems such as Windows 95/98/ME
etc, etc.
If your program is a stand-alone application with no dependencies and can run on a stock-standard install of Windows 95... then you don't need to worry about setup ;) But if your app has any external dependencies then you want to spend some time on setup.

Resources