我寻求一种解决方案,通过互联网更新我在“C#/ .NET / WPF”中开发的程序。 该项目包含具有不同文件类型和不同库(dll)的子目录。
到目前为止,我将我的程序分发到包含所有文件(总共800kb)的.zip文件中作为便携式解决方案。
我并不特别需要设置,但我寻求免费的升级解决方案。
我尝试了 ClickOnce ,但是无法以“便携方式”分发应用程序,并且安装应用程序的地方也不适合我。
< / LI>我看了 WiX ,但是有一个功能可以通过互联网通知并进行更新吗?
其他解决方案?
答案 0 :(得分:0)
我在msdn上找到了类似的东西:
private void InstallUpdateSyncWithInfo()
{
UpdateCheckInfo info = null;
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
try
{
info = ad.CheckForDetailedUpdate();
}
catch (DeploymentDownloadException dde)
{
MessageBox.Show("The new version of the application cannot be downloaded at this time. \n\nPlease check your network connection, or try again later. Error: " + dde.Message);
return;
}
catch (InvalidDeploymentException ide)
{
MessageBox.Show("Cannot check for a new version of the application. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message);
return;
}
catch (InvalidOperationException ioe)
{
MessageBox.Show("This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message);
return;
}
if (info.UpdateAvailable)
{
Boolean doUpdate = true;
if (!info.IsUpdateRequired)
{
DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?", "Update Available", MessageBoxButtons.OKCancel);
if (!(DialogResult.OK == dr))
{
doUpdate = false;
}
}
else
{
// Display a message that the app MUST reboot. Display the minimum required version.
MessageBox.Show("This application has detected a mandatory update from your current " +
"version to version " + info.MinimumRequiredVersion.ToString() +
". The application will now install the update and restart.",
"Update Available", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
if (doUpdate)
{
try
{
ad.Update();
MessageBox.Show("The application has been upgraded, and will now restart.");
Application.Restart();
}
catch (DeploymentDownloadException dde)
{
MessageBox.Show("Cannot install the latest version of the application. \n\nPlease check your network connection, or try again later. Error: " + dde);
return;
}
}
}
}
}
http://msdn.microsoft.com/en-us/library/ms404263.aspx
要指定备用更新源,您可以使用MageUI
1.打开.NET Framework命令提示符并键入: mageui.exe
2.在“文件”菜单上,选择“打开”以打开应用程序的部署清单。
3.选择“部署选项”选项卡。
4.在名为Launch Location的文本框中,输入将包含应用程序更新的部署清单的目录的URL。
5.保存部署清单。