Winforms Clickonce重新启动每三次生成和发布失败一次

Winforms Clickonce重新启动每三次生成和发布失败一次,winforms,clickonce,Winforms,Clickonce,ClickOnce和WinForms应用程序.Net版本4有问题。我可以安装该应用程序,它可以很好地与2.1.79.1版配合使用 然后,除了将发布版本更改为2.1.79.2并重新编译和发布之外,我什么也不做。当我运行应用程序时,它会正确更新并重新启动,不会出现问题 然后,除了将发布版本更改为2.1.79.3并重新编译和发布之外,我什么也不做。当我运行应用程序时,它似乎更新正确(没有错误消息),但当应用程序尝试重新启动时,会出现一条消息,上面写着“应用程序无法启动”,我收到下面列出的“值不在预期范

ClickOnce和WinForms应用程序.Net版本4有问题。我可以安装该应用程序,它可以很好地与2.1.79.1版配合使用

然后,除了将发布版本更改为2.1.79.2并重新编译和发布之外,我什么也不做。当我运行应用程序时,它会正确更新并重新启动,不会出现问题

然后,除了将发布版本更改为2.1.79.3并重新编译和发布之外,我什么也不做。当我运行应用程序时,它似乎更新正确(没有错误消息),但当应用程序尝试重新启动时,会出现一条消息,上面写着“应用程序无法启动”,我收到下面列出的“值不在预期范围内”错误

所以我卸载程序,然后重新安装。版本2.1.79.3运行良好

除了将发布版本更改为2.1.79.4并重新编译和发布之外,我什么也不做。一切都很好。我更改为2.1.79.5版,重新编译并发布,所有内容都已找到。我改为2.1.79.6,更新似乎正在运行,但重新启动应用程序会出现“值不在预期范围内”错误

在这些构建之间,除了在“项目属性”的“发布”选项卡上更改发布版本的最后一个编号外,我什么都不做。没有代码被更改。每三次构建和发布都会以这种方式失败

有没有人知道会发生什么,或者有没有人建议我如何解决这个问题

PLATFORM VERSION INFO
Windows             : 10.0.15063.0 (Win32NT)
Common Language Runtime     : 4.0.30319.42000
System.Deployment.dll       : 4.7.2046.0 built by: NET47REL1
clr.dll             : 4.7.2046.0 built by: NET47REL1
dfdll.dll           : 4.7.2046.0 built by: NET47REL1
dfshim.dll          : 10.0.15063.0 (WinBuild.160101.0800)

SOURCES
Deployment url          : file:///C:/Users/MyUser/Desktop/MyAppName.appref-ms%7C

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\MyUser\Desktop\MyAppName.appref-ms| resulted in exception. Following failure messages were detected:
    + Value does not fall within the expected range.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [5/8/2017 9:06:00 AM] : Activation of C:\Users\MyUser\Desktop\MyData.appref-ms| has started.
* [5/8/2017 9:06:00 AM] : Performing necessary update check as specified by the deployment.

ERROR DETAILS
Following errors were detected during this operation.
* [5/8/2017 9:06:00 AM] System.ArgumentException
    - Value does not fall within the expected range.
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.NativeMethods.CorLaunchApplication(UInt32 hostType, String applicationFullName, Int32 manifestPathsCount, String[] manifestPaths, Int32 activationDataCount, String[] activationData, PROCESS_INFORMATION processInformation)
        at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)
        at System.Deployment.Application.SubscriptionStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)
        at System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId appId, AssemblyManifest appManifest, String activationParameter, Boolean useActivationParameter)
        at System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String shortcutFile, String& errorPageUrl, TempFile& deployFile)
        at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl, Uri& deploymentUri)
        at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
--- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
        at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
        at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

为什么要手动更改版本?使用clickonce,版本会在每一天自动递增publish@jonathana这就是故障排除的方法。它不起作用,所以我把它分解成最小的变化。代码本身没有任何变化。我没有添加、删除或更改任何库或引用。在两次生成之间唯一改变的是版本号,我不会得到错误,然后我会得到错误。@jonathana同样,自动增加版本号是可选的。如果你想自己控制它,无论出于什么原因,你都可以,但这与我的问题无关。你读了吗?:@jonathana是的,我想StackOverflow上的大多数其他相关帖子。其中的堆栈跟踪与我得到的不同,所以我认为这可能是一个不同的问题。列出的解决方案要么不起作用,要么路径中没有“&”,要么它们不是真正的解决方案,清除缓存是一种解决方法,而不是解决方案。