Click here to Skip to main content
15,663,550 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am deploying a win app using a setup file which downloads and runs from a website.

1 How can I check for new version from withing the application and if possible to force the user to take this version?

2 I am using the settings.settings file to store user values. These are overwritten when a user takes an upgrade. How do I keep these settings?

Have you considered ClickOnce[^]?

Instead of using settings file, you could store the settings in another file (xml-format perhaps) created by your program. This way the file won't get overwritten since you control it (create if necessary, update normally).
Share this answer
milenalukic 9-Apr-11 10:25am    
I considered the click once and found the following problem:
if users did not accept update by mistake I would need to recompile as it does not offer the update again.

how would you use the xml settings? Could you give an example please?
Wendelius 9-Apr-11 11:39am    
About the rejected update, have a look at this. Perhaps it helps:

And about the settings file, you could use for example XmlWriter and XmlReader to store the data you want where you want (for example in users profile/appdata directory. See:
Try this one, and u will never use anything else again.
basicly just import the thing and choose ini/xml/or reg in ur application i prefer ini, so i can have all my projects portable and just one dir with managed ini's
And for the updates force an mutex singleapp that always checks for updates , and have a static addOn directory that always takes the compiled assemblys from that dir instead of the embeded ones.
this way you can always keep the old instalation and can always add or inprove by just one single dll file

something like
<br />
	private void LoadAddIns()	<br />
		{<br />
			DirectoryInfo addInDirInfo = new DirectoryInfo(Path.Combine(Application.StartupPath, "AddIns"));<br />
				if (addInDirInfo.Exists)<br />
				{<br />
				// Get all of the assemblies in the AddIns directory<br />
				foreach (FileInfo fileInfo in addInDirInfo.GetFiles("*.dll"))<br />
				{<br />
					// Load the assembly and iterate through all of the types in it.<br />
					Assembly assembly = Assembly.LoadFrom(fileInfo.FullName);<br />
					foreach (Type type in assembly.GetTypes())<br />
					{<br />
						// If the type <big>implements</big> , create an instance of it and add it to the program<br />
						if (type.GetInterface(mystuff) != null)<br />
						{<br />
							classProvider = (myclass)Activator.CreateInstance(type);<br />
							Program.Add(classProvider);<br />
							}<br />
					}<br />
				}<br />
			}<br />
		}<br />
<br />

And have this before all other code so you can always overrule an old assemby
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900