赢得应用安装文件的新版本 [英] Win app setup file new version

查看:70
本文介绍了赢得应用安装文件的新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用从网站下载并运行的安装文件来部署Win应用程序.

1如何从应用程序中检查是否有新版本,并在可能的情况下强迫用户使用此版本?

2我正在使用settings.settings文件存储用户值.用户进行升级时,这些设置将被覆盖.如何保留这些设置?

Hi,

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?

推荐答案

您是否考虑过 ^ ]?

除了使用设置文件,您还可以将设置存储在程序创建的另一个文件中(也许是xml格式).这样一来,文件就不会被覆盖,因为您可以对其进行控制(必要时创建,可以正常更新).
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).


尝试使用此文件,您将永远不会再使用其他任何文件.
基本上只导入东西,然后在我喜欢的ini应用程序中选择ini/xml/或reg,这样我就可以将我所有的项目移植到可移植的目录中,并且只有一个目录包含受管理的ini的

http://www.codeproject.com/KB/cs/readwritexmlini.aspx
对于更新,强制使用一个互斥量singleapp,该app始终检查更新,并具有一个静态addOn目录,该目录始终从该目录获取已编译的程序集,而不是嵌入的程序集.
这样,您可以始终保留旧的安装,并且始终可以仅通过一个dll文件进行添加或验证

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

http://www.codeproject.com/KB/cs/readwritexmlini.aspx
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 />
</code>


并在所有其他代码之前使用此代码,以便您始终可以推翻旧的assemby


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


这篇关于赢得应用安装文件的新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆