我的团队在将Clickonce应用程序从dot net 2.0升级到dot net 4.0时遇到了问题。
此外,我们怀疑这是Clickonce工具链中的错误。
核心症状:
以下是我们最初遇到的情景:
我们的大型企业应用程序具有使用Microsoft Clickonce发布平台安装和分发的胖客户端。
我们有一个3.8.90.24版本,它是dot net 2.0。
我们的下一个版本是3.8.100.19(到目前为止),它是dot net 4.0。
我们在服务器上部署了第一个版本。请注意,此特定方案托管在URL上,但它也可以使用文件路径部署。
我们已从第一个版本安装了Clickonce客户端。
我们在服务器上部署升级版本,完全删除以前的版本,并替换文件。
下次运行Clickonce客户端时,系统会提示我们升级(按照惯例和预期),然后点击“确定”。
此时会显示错误对话框:
An error occured while trying to check for updates to the application.
Do you want to attempt to reinstall from the original installation location?
[ Yes ] [ No ]
选择是重新安装,它可以正常工作(手动取消/重新安装)
选择否会启动旧客户端。如果您随后关闭客户端,然后再次打开该应用程序,则会正确升级。
这是一组令人困惑的症状。
我设置了日志记录并找到了以下内容:
从命令行构建,也没有错误,例如:
msbuild /target:publish /p:PublishUrl=http://[FooApplication]/Clickonce/ /p:PublishDir=C:\inetpub\wwwroot\ClickOnce\
然后,因为我想检查文件哈希,我安装了" windows管理框架4.0"使用Get-FileHash命令获取PowerShell 4.0,然后重新启动。
我按照这些指南开启了详细记录。
我在这里发现了错误的一些变化。
以下是日志的主要摘录(如果需要,我很乐意提供更多信息):
'准备'安装,该版本的升级从此平台信息开始:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 2.0.50727.5485
System.Deployment.dll : 2.0.50727.5488 (Win7SP1GDR.050727-5400)
mscorwks.dll : 2.0.50727.5485 (Win7SP1GDR.050727-5400)
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
新版本的全新安装,或升级尝试后安装程序的第二次运行都有以下信息:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.18444
System.Deployment.dll : 4.0.30319.34244 built by: FX452RTMGDR
clr.dll : 4.0.30319.18444 built by: FX451RTMGDR
dfdll.dll : 4.0.30319.34244 built by: FX452RTMGDR
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
有趣的是,不仅版本信息发生了变化,而且还有平台的结构。
在安装/重启之前捕获的原始错误日志中发生了一个有趣的事件序列:
以下是来自不同场景的两个错误:
从' Live Install'进行升级。文件:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 2.0.50727.5485
System.Deployment.dll : 2.0.50727.5488 (Win7SP1GDR.050727-5400)
mscorwks.dll : 2.0.50727.5485 (Win7SP1GDR.050727-5400)
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
[-SNIP-]
ERROR DETAILS
Following errors were detected during this operation.
* [1/12/2015 2:38:45 PM] System.Deployment.Application.InvalidDeploymentException (ManifestLoad)
- Exception occurred loading manifest from file [my.app.namespace].Shared.XmlSerializers.dll: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ManifestLoadExceptionHelper(Exception exception, String filePath)
at System.Deployment.Application.Manifest.AssemblyManifest.LoadFromInternalManifestFile(String filePath)
at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
--- Inner Exception ---
System.Deployment.Application.DeploymentException (InvalidManifest)
- Cannot load internal manifest from component file.
- Source:
- Stack trace:
[-SNIP-]
(There is nothing listed under the final 'stack trace' line)
从本地IDE发布升级:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 2.0.50727.5485
System.Deployment.dll : 2.0.50727.5488 (Win7SP1GDR.050727-5400)
mscorwks.dll : 2.0.50727.5485 (Win7SP1GDR.050727-5400)
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
[-SNIP-]
ERROR DETAILS
Following errors were detected during this operation.
* [1/12/2015 3:01:28 PM] System.Deployment.Application.InvalidDeploymentException (ManifestLoad)
- Exception occurred loading manifest from file [my.app.namespace.client].Shared.dll: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ManifestLoadExceptionHelper(Exception exception, String filePath)
at System.Deployment.Application.Manifest.AssemblyManifest.LoadFromInternalManifestFile(String filePath)
at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
--- Inner Exception ---
System.Deployment.Application.DeploymentException (InvalidManifest)
- Cannot load internal manifest from component file.
- Source:
- Stack trace:
[-SNIP-]
请注意,这些是不同的DLL文件! (这些对于每个单独的发布都是一致的,区别在于完整构建过程的版本与本地IDE发布之间的版本)
此时,据我所知,当在dot net 2.0和4.0之间进行转换时,Clickonce部署在验证清单文件时遇到问题。一旦它转换到使用dot net 4.0工具包,一切都很好。
这会让我们的用户感到困惑,' no'意味着他们暂时运行一个过时的客户,并且“是”'意味着他们失去了一些本地设置。
我猜测验证过程中的哈希算法或其他机制发生了变化,升级尝试使用的2.0版本不是100%兼容的。
我的任何实际问题:
之前有没有遇到过这个?到目前为止,它一直拒绝使用谷歌搜索,虽然有时会出现类似的签名问题,但这种特定的升级方案已经让我望而却步。
我可以收集哪些有用的信息?
我是如何解决或解决此问题的,考虑到我们在多个地点的字段中都有以前的版本,而新版本尚未发布?