Auto-updating in Corporate Environments (C#) - c#

I have a three-tier application which is installed in corporate environments. With every server version update, all clients have to be updated, too. Currently, I provide an MSI package which is automatically deployed via Active Directory, however my customers (mostly with 20-300 users each) seem to hate the MSI solution because it is
Complicated to get it running (little Active Directory knowledge);
The update process can't be triggered by the server, when a new version is detected;
Customers can't install multiple versions of the client (e.g. 2.3 and 2.4) at the same time to speak to different servers;
The update process itself doesn't always work as expected (sometimes very strange behaviour healing itself after a few hours)
I've now made a few experiments with ClickOnce, but that way to unflexible for me and too hard to integrate in my automated build process. Also, it produces cryptic error messages which would surely confuse my customers.
I would have no problems to write the update logic myself, but there the problem is that the users running to self-updating applications have too restricted rights to perform an update. I've found that they are able to write to their Local Application Data directory, but I don't think this would be the typical place to install application files into.
Do you know a way to an update that "just works"?

You can somewhat replicate what ClickOnce does, just adjust it for your needs.
Create a lightweight executable that checks a network/web location for updates.
If there are updates, it copies them locally and replaces the "real" application files.
It runs the "real" application.
The location for the application files should be determined by permissions and operating system. If users only have write permission to a limited set of folders, then you don't have a choice but use one of these folders. Another option is provide an initial installation package that installs the lightweight executable and grants r/w permission on a specific folder such as "C:\Program Files\MyApp". This approach usually requires a buy-in from IT.
I hope this helps.

It is really hard to provide you exact answers because critical information about the client side installer is not explicit. Do you install client side files into Program Files? Then you may meet problems when users are restricted.
You don't think Local Application Data is a folder to deploy application, but Google does. Its Chrome browser installs that way on Windows, and its automatic update process is even unnoticable (which may sound horrible). So why not deploy your application into this folder for restricted users? You may find more about Chrome installer here,
http://robmensching.com/blog/archive/2008/09/04/Dissecting-the-Google-Chrome-setup.aspx

Here's an open-source solution I wrote to address specific needs we had for WinForms and WPF apps. The general idea is to have the greatest flexibility, at the lowest overhead possible. It should give you all the flexibility you need for all that you have described.
So, integration is super-easy, and the library does pretty much everything for you, including synchronizing operations. It is also highly flexible, and lets you determine what tasks to execute and on what conditions - you make the rules (or use some that are there already). Last by not least is the support for any updates source (web, BitTorrent, etc) and any feed format - whatever is not implemented you can just write for yourself.
Cold updates (requiring an application restart) is also supported, and done automatically unless "hot-swap" is specified for the task.
This boild down to one DLL, less than 70kb in size.
More details at http://www.code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/
Code is at http://github.com/synhershko/NAppUpdate (Licensed under the Apache 2.0 license)
I plan on extending it more when I'll get some more time, but honestly you should be able to quickly enhance it yourself for whatever it currently doesn't support.

If you don't want to give your users too many rights, it is possible to write a Windows Service, which will run on each computer under an account with the appropriate privileges, and which can update your application, when a new version gets available.

Related

installer- Setup project in VS 2015

I am working on a window application (Ex. a calculator) in VS2015. I had created a setup file for this application which will install the application in PC. Can we write code inside the setup project (like adding a new .cs file or something like that) because I am trying to create my own product key (custom key) specific to every PC? Also, that code should run while installing the product very first time on desktop asking for the product key to the user. Once the window application gets installed, whatever code written inside the main project (calculator, not in setup project) should only get executed.
If anyone could suggest some other way so that the application should ask for custom product only during the time of installation.
Application, First Launch: Many deployment guys tend to recommend putting licensing in the application itself - on first launch. There are many reasons, and here is an attempted explanation: Installer with Online Registration for Windows Application.
Custom Actions: Custom actions are used to do unusual or proprietary stuff in an MSI setups. Custom actions are legendary for being very difficult to get right and reliable due to the overall complexity of MSI and the complexity of deployment overall (section "The Complexity of Deployment"). Essentially custom actions are complex with sequencing-, conditioning- and impersonation issues and overall poor debugability.
Bottom Line: When you implement logic in your application launch code you are in familiar territory with no impersonation or debugging difficulties to deal with. Much easier to develop. Much easier to debug and maintain.
Per-User Licensing: The challenge is that your application must write to HKCU or the user profile - unless it runs elevated with admin rights. I prefer licensing to be done per-user, potentially allowing the license to roam with the user. Or to use an online licensing approach with licensing set up once over the wire. For example by a login approach to the application. You log into an online service and all licensing is part of that.
P.S: It is possible to apply ACL changes to HKLM allowing a non-elevated application to write a license key to HKLM. Possible, not a recommendation.

Is Winium.Desktop required to be running even post development?

I am new to the Winium world. I tried playing with Winium.Cruciatus which seems to be working fine but not perfect.
Hence, I am thinking to try Winium.Desktop.Driver.exe which I understand -
is a Selenium-compatible wrapper for Cruciatus, and
it is required to be running separately while development.
However, I wanted to understand that once the development is done and
if the solution is deployed in production, will it
(Winium.Desktop.Driver.exe) still be required to be running in advance
for the solution to work?
My requirement:
To automate the installation of a software on multiple VMs (domain joined) from one single VM.
If (yes)
{
I think it may block the installation if it requires explicit Admin
permission to run. As we cannot go on each machine to click on 'Yes',
which defeats the purpose of automation.
Because my environments will be Windows Server 2012 R2 and most of
the time they are more restricted than a normal Windows like Win10.
}
If (no)
{
Any specific advantage of using Winium.Desktop.Driver vs only developing with Cruciatus library?
}
Note: Can someone of high reputation please create a new tag - 'Winium' as it seems this is required now as we already have few more questions
on Winium.
Winium.Desktop is a testing tool, it is usually used to automate end-to-end or other functional testing scenarios. When it is used as testing tool, then it is only required during development/testing phase, not in production.
But if you use Winium.Desktop not for testing, but as an automation tool, for example to automate installation of a software, i.e. Winium.Desktop is a core part of solution that runs setup program and clicks next or something, then you will need Winium.Desktop during deployment phase.
Key advantage of Winium.Desktop over Cruciatus is that it provides Selenium interface and works as client-server, which is useful for test automation, as client-server can be scaled, and Selenium interface is well known and there are a lot of tutorials on how to use it.
If you just need to automate installation of some software (i.e. do not need to do actual testing using Winium), I would suggest looking into direction of one of IT infrastructure automation tools like Ansible, Chef, etc.
Regarding admin rights I suggest to open an issues at https://github.com/2gis/Winium.Desktop/issues describing your use case, probably there is a way to run it without admin rights or grant access only once.

Use Git locally at work in conjunction with custom "source control"

At work, we are required to use a custom "source control" system. Basically, it takes snapshots of our code whenever we push new changes to our live environment. There are no rollback capabilities except to get a copy of the last live push, there are no mechanisms for seeing who changed what, and once one person is working on the code someone else can change the source and you would not know (unless you spotted the change).
I would like to implement Git in this environment but I'm not wise enough in the ways of Git to figure out how best to do this. Here are the requirements that I need to handle:
Source code is stored on a remote file path.
Once I start a project, anyone can change the remote source (I would like to capture these changes if possible).
The source is (usually) existing before I start to work on it.
After I complete a project, someone else may change the source (not using Git).
I am going to attempt to get the rest of my coworkers involved in doing this too.
I have only file read/write access to the remote server.
My coworkers do not like the command prompt (and, quite frankly, I prefer to use a GUI), so use of a GUI (like GitHub for Windows or, even better, the Team Explorer tools inside Visual Studio) would be a high priority.
We are a Windows-only shop specializing in C# and ASP.NET MVC so any solutions would need to work inside those bounds.
The impact on the remote files and folders should be minimal. I know Git is light but anything I can do to keep it as invisible as possible will be great.
I've looked into how to do this but I've not found a good solution that works for me (or at least that I understand would work for me). I found this article but it didn't appear to really work well for my environment (again, maybe that is my lack of understanding):
http://mattsnider.com/develop-locally-using-git-instead-of-your-company-s-crappy-version-control/
Any help that you can give would be much appreciated. I would really appreciate it if the help you give is doable for a Git user (me) who is not very knowledgeable. Steps to follow and instructions on why would be tremendous.
If your employer already has an established version control system that can handle all their different artefacts that the company needs to store (which will be more than just source code) then don't even try to actually change their system.
The question is more about how you can help yourself, which will depend on the level of access you have to personal storage and to network storage - the latter being maintained by others.
Assuming you have local storage, then you can set up a git repository within your own local copy of the source code. You would then set up a remote on a/your network drive to act as your back-up. (as described in the blog you reference).
I use (variously) Git-for-Windows, Git-Gui, gitk, and Git Extensions for my development so that I can pick and mix the best tool/command for any particular task. I find it especially useful for my Matlab development with its rapid interactive edit-fix-update common in (my sort of) systems engineering.
When I have a stable version in a commit, that I want to send back to the company VCS, I can then check it out/back-in (or whatever their process demands) to their system (do tag that commit).
Likewise if there is an update to another file that you need from their VCS you should have a branch for receiving it's checkout, followed by a merge back into your development branch (or whatever flow most suits you).
Regularly push your local repo onto your bare network repo so you have a backup and some security. You can always bundle your repo, or archive a commit as required for other backups if you need.

Is there a framework that works the way like updating a virus definition database?

my distributed program need update couple of files, i would like it to work the way like those anti virus software updating there virus definition database, is there such framework?
Edit:
I am not updating the application itself.
when the update is done, the application may need reboot.
A server will be open for update query and downloading.
It really depends on the how your data is formatted. If you're keeping a simple local storage in text files, then it's just a matter of hitting up a server and checking if there is a new version of the file(s). If you're keeping things in local SQL storage, then you could use web services to ensure the local storage has the most up-to-date entries. I think that option is what you're looking for, and it would be really easy to write. However, if you're looking to update applications, then something like ClickOnce might be ideal.
In response to your edits
Basically, you have to structure your application to read all information from information files and give those files some meta-information like a "version number" or something like that. Then, you have an ASP.NET web service which has two functions: one is to get the latest version of the information files and the second is to download the updates needed to patch from one version to the current. So, the application would intermittently check with the server to see if there is a newer version than what they have. If there is a newer one, then it would ask the server for the patch files needed to get to the latest version. If you do this before the application actually starts (a la Firefox), the user doesn't even have to notice that the application is restarting.
As far as I know, I am not aware of such a framework. However, the magical stuff is done by Web services or Windows Services looking for updates at a HTTP or FTP location. You might perhaps wirte yourself a code that would launch the script you deploy with your update.
Perhaps this would help a bit: Loading Assemblies. In short, this is the way plugins are plugged in your application, using proxies and so forth.
As mentioned by #Travis G, ClickOnce is good for application. Just different approach! =)

Hosted Source Control?

I'm working on a few closed-source projects. (Small ones.) I don't want to share the code of these projects. But I do want to have an easy-to-install version control system that's easily installed on my web host.
I don't have administration rights on this web host so I can't just run a setup.exe on the remote system. Basically, the only way to install something is by just creating a database and copying files to the server and maybe a bit more by using a Plesk control panel.
I can choose between two hosts: one using Linux with MySQL and the other Windows 2008/IIS7 with SQL Server 2005. The Windows host has my preference, since it provides the most disk space.
So, what options do I have? (Doesn't have to be free, although I do have a limited budget.)
I can have physical access to both hosts to install some additional software but it means traveling about 5.000 KM to the server room. I can also tell someone at the location of the server to install it for me, but that's quite expensive. I could just find another company to host this for me but I like my current servers/hosts. So that's why I'm looking for a solution that I can simply upload to the server.
I would highly recommend both Assembla and Unfuddle. They offer different types of version control (SVN, GIT, etc.), as well as ticket management, messaging between teams, wikis, and many many other tools that I haven't gotten into yet.
I have been using Assembla and have found it to be very intuitive and offer great features, such as automatic integration between the ticketing system and the version control system. I use the free version and just hope that no one browses/steals my code until that particular project gets to the point where I should consider paying their small fee to guard it :)
Do comment on what you choose to do!
I run Subversion on Dreamhost for less than $10/month. Most of my projects are pretty small so far--I know they don't always appreciate large amounts data as non-web-accessible storage. It is first a web host, not a file host. However, its pretty easy to set up SVN repositories in their admin interface and then you have an easy svn+ssh connection.
Of course, since it is a web host it's easy to install Trac (they even have a 1-click install for it) or some other piece of software as well.
What is preventing you from using hosted services like:
Bean Stalk
Project Locker
They offer a range of accounts including those that are free.

Categories

Resources