C# .NET Application Settings and Upgrading - c#

I use Settings.Default.MySettingName & Settings.Default.Save to save and load settings. When I change my version number how am I able to get the settings from the old version and apply to them my new version? I just can't quite figure it out.

Settings.Upgrade() looks like it has some promise - check out this post - and note that this method should be called once-and-only-once by your application.

Related

Application settings cannot be upgraded

My C# application uses the default C# settings mechanism. The problem here is, that everytime I change my application's version number, all settings are gone and reset to their defaults.
Thus I implemented the upgrade mechanism described here.
Problem 1:
The weird thing is, that this seems to have no effect. After the upgrade code is executed, all settings still have their default values and none of the old values have been loaded.
Does the upgrade mechanism not work?
Problem 2:
Also after saving the settings, a new settings folder is created in AppData/Local (the name differs in the URI part). So after a couple of versions there are dozens of these folders lurking around, which does not feel right.
Is it normal behavior that an application creates new settings folders for each version?

How to create RDFS based on RDF/XML file?

For my project, I need to get the RDFS from CIM RDF/XML (IEC 61970). .NET Framework does not have standard tools for working with RDF. Please help me solve my problem.
Does it have to be with C#?. I use JAVA + JENA to process the CIM/XML files to extract it data. (It works fine with the CIM 16 schema version "http://iec.ch/TC57/2013/CIM-schema-cim16#").
Maybe you can create the JAVA code and call it from C# or use any native .NET library for parsing XML. In this post How match JAXB elements in CIM/RDF? seems they are working with JAXB.

Facebook graph API version expires

I have developed an application in C# that uses the FacebookClient class. The version if this FacebookClient is 7.0.6. First of all it is the first time i use the facebook graph api, so sorry if i ask basic questions :)
When i go to the application in developers.facebook i see a warning containing the following text:
When i use the Get method on the FacebookCient class then i am not specifying any version. The Version property of the FacebookClient is null when i read it.
So my questions are:
Shouldnt the FacebookClient class automatically use the latest version of the graph API when no version are specified? It looks like it uses v2.0 even thoug v2.6 is the newest.
How can i make sure that it always uses the newest version possible?
Since i havent so much experience with the facebook api, what is the prefered way to deal with this?
Can i use a specific version by setting the Version property to e.g. "v2.6" or .Get("/v2.6/someCall")?
You can ignore the warning, there is an open bug for this: https://developers.facebook.com/bugs/1634445133540643/
If you omit the version, it will use the API version of the App, not the latest version. It´s always the latest one if you create a new App, but it will not upgrade automatically.
Btw, there is an upgrade tool: https://developers.facebook.com/tools/api_versioning/

Get previous version settings for C# application

I have an old Winforms application that stores user settings. I have completely rewritten the application in WPF and would like to migrate the settings. I can't use the Upgrade() method since I have changed the names of most of the user settings. I found the GetPreviousVersion() method but it fails since the old settings no longer exist in the new application. Also, the applications are in different namespace's which I hear causes some issues. Any help would be great.
Why not open up the original application and run Upgrade() just to see the results it produces? You could then also try GetPreviousVersion() too.

Online updating a C# program

Greetings,
I'm sorry if this question has been asked already. I've tried using the search function but couldn't find any answer that suited my situation.
I have a real simple C# form application of only 1 file, a exe.
I distributed this currently by 4shared where people can download it as pleased.
However, every time I make changes to the program people will have to download the new version from 4shared.
Now this isn't a ideal situation and I'm a noob when it comes to creating upgrade but the situation I wish is that the program looks at a website / ftp server where I deploy a new version.
I'm looking for a way inside my program to look at the file on that website / ftp server and decide wether there's a new version available.
If there is a new version available in the website / ftp server I would like for the program to update itself to the newest version.
Hope you guys can help me out with this and I hope I explained my situation enough !
NetSparkle is a nice alternative to click-once with more deployment options. http://netsparkle.codeplex.com/
Have a look at ClickOnce. It will do this for you.
When I'm developing and publishing such applications, I usually do it the following way:
Develop a .NET Windows Forms application
Develop a tiny ASP.NET application with an ASMX web service.
Publish the ASMX web service to my public web site.
Add a WSDL reference for the web service to my Windows Forms application.
Create a setup (I prefer Unicode NSIS over ClickOnce).
The logic I implement in the SOAP web service is basically a single function:
[WebMethod]
public string CheckUpdateAvailable( string currentVersion )
{
...
}
The Windows Forms application calls this method (e.g. from a background thread upon program start), passing its current assembly version as a string to the function.
The WSDL function in turn checks the passed version against the newest setup version (e.g. being stored inside web.config or extracted live from the setup.exe on the server). If a newer version exists, it return a string with the URL to download from; otherwise it returns NULL.
When the caller of the WSDL function gets a non-NULL string, it can show a message to the user, asking whether he wants to download and install the executable and then simply execute the URL (via Process.Start).
WyUpdate is the way to go here. We've been using it for over a year with great results (they have excellent support too).
It actually uses patches to update files so that when a 5MB executable only has a small change, the client only has to download a file in the order of kilobytes.
They supply an automatic update component for either Windows Forms or WPF that looks nice and works great.
You can host the update files on either an FTP server or a normal website without any server-side configuration.
There's plenty more to it, and the best place to start is with their video tutorial of how to set up an update.
Here's an open-source library 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. All you'll have to do is create an update feed and reference the library from your app.
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 set 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 all boils 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.

Categories

Resources