Solved

Updating C# Windows Forms Application

Posted on 2011-09-20
12
411 Views
Last Modified: 2012-08-14
Hello all.

I have a Windows Forms application that I would like to be able to update in the future. Currently, it is running on ClickOnce, however, it is becoming more and more clear that it isn't the right solution for our project.

What other options do we have for creating an auto updating application?
0
Comment
Question by:Dragonseer
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 13

Expert Comment

by:Naman Goel
ID: 36567914
I am not able to understand your problem, please explain more.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36568100
A launcher program.

Instead of launching the application, the user starts the launcher.

The launcher compare what is on the user computers with what is available at the update site. Could be only a .txt file with the application version in it, or could be more complex with a list of files and a version for each file. This last one could speed up updates, because you could only update the files that have changed, not the whole thing.

If changes are detected, the launcher copy the new files to the user computer. Since most .NET assemblies do not need to be registered, that is an easy task.

Once everything is ready, the launcher starts the real application.
0
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 36568633
A slippery slope ... how do you update the launcher itself? For some reason developers (myself included) always seem eager to reinventing a deployment strategy, but it's usually not that straightforward. In this day and age, I find it hard to believe that you would need to do this.

Is is possible that clickonce is presenting some challenges that could be resolved if you knew how?
0
 
LVL 40
ID: 36569201
The launcher could itself be updated through ClickOnce. Farfetched, but possible.

What are the problems you are encountering with ClickOnce that could prevent you from using it? You can to a certain measure customize what happens during a ClickOnce update (http://msdn.microsoft.com/en-us/library/dd997001.aspx). That might enable you to circumvent some difficulties.

In this day and age... where everybody yells at all the gods when a security breach is encountered, nothing is simple :-) It takes us only 1 line of code to do what used to take 100, but how come that we need to write as many lines to have our applications follow the specifications.
0
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 36569308
I had to slug through quite a few issues with c.o. concerning code signing, Team Builds, versioning and even dev/test/prod build simultaneous deployments. Each hurdle seemed crazy but had a simple solution in the end. Lack of information is the biggest hurdle, really.
0
 

Author Comment

by:Dragonseer
ID: 36570881
I was thinking that the launcher would update the program which would update the launcher.

ClickOnce is starting to get in the way of simple software delivery to our clients. We need one exe that can be linked to or email which simply executes and installs all the files in the Program Files directory rather than some obscure AppData > 2.0 directory.

We also need a license acceptance page, which I cannot find the option for in ClickOnce.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 40
ID: 36571084
I was thinking that the launcher would update the program which would update the launcher.

I never thought of that one, but it makes sense.

-------

Program Files vs AppData.

For most users, having a shortcut on the Start menu and a way to uninstall the program from the Control Panel is all they need, so the location of the program files is not very important.

This "obscure" directory solves a few problems.

Because it is obscure, the users are less prone to go play in it and break the application.

Program Files is read only for a user that is not an administrator. AppData is not. It thus makes it easier, if you have files that the application needs to write to, to have everything in one place.

Automatic rollback from the Control Panel if a new version shows to be defective.

True, ClickOnce also has its limitations, such as not way to install in the GAC, no way to install drivers, individual users installation. But it also has its advantages. You have to balance both before taking a decision.

-------

For the license acceptance page, the first paragraph of the link I sent you avout customizing a ClickOnce installation just point in that direction: A custom installer can implement custom user experience during installation, including custom dialog boxes for security and maintenance operations.
0
 

Author Comment

by:Dragonseer
ID: 36571304
Hey James.

So it looks like I was able to figure out how to get the installer down to one exe and now I know how to implement a license acceptance page.

My question would be if its possible to:
- Move the install from C:\Users\User\AppData\Local\Apps\2.0\NQZ384A2.ELW\HQN68NQC.Q4M\wate..tion_0000000000000000_0001.0000_5f58013f3541da32 to C:\Users\User\AppData\Local\CompanyName\AppName\
- Install application for everyone, not just local user.
0
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 36571328
I don't think that's possible. From my experience it's designed from the get-go to be local. I wonder if you figure out a scenario where the first user acceptance of the license satisfies the remaining installations. Assume that's where you're going with this. If the app is granted the needed permissions to the reg, for instance, it could write there.

Glad to see you're making progress. As I suspected, it's often just a matter of closing in on those few challenges that seen huge, but aren't in reality.
0
 
LVL 40
ID: 36571851
It everything is included in one .exe and you have customized ClickOnce, it might be possible to simply copy the .exe to Program Files and create a shortcut in the Users default directory. Just an idea though, not even sure if security would permit it.

The problem with that approach is that updates would be delivered only to the user that first installed through ClickOnce. Those who start from Program Files would get their update only when that first user would trigger it throuhg his own ClickOnce install.
0
 

Author Comment

by:Dragonseer
ID: 36578568
Hello Todd / James.

I have a new question: is it possible to integrate the Runtime Installations and their license requirements into my ClickOnce install? We're trying to make this as simple as possible for our clients where they click two or three buttons and the installation runs and completes without them having to come back to click on another button every few minutes, since the installation holds up if you don't provide this input (such as clicking Install in the various windows once ClickOnce has already started up.

As for the Public directory issue, we figured out a solution that works for us. Rather than writing the database file to LocalUserAppData, we are now writing it to Users>Default>AppData>CompanyName>AppName. This way, even if a different user install the same application, the source file for all of the applications data will be a a consistent location that everyone can access.
0
 
LVL 40
ID: 36578728
If by "the Runtime" you mean the framework, yes. By the same toke, you can install a few other things such as Sql Server Express and the Microsoft Primary Interop Assemblies.

It is under the Prerequisites button of the Publish tab of the Project's Properties window.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now