C# “值不在预期范围内” ClickOnce 部署

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9704532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 08:29:20  来源:igfitidea点击:

"Value Does not fall in the expected range" ClickOnce Deployment

c#vb.netclickonce

提问by Fr33dan

I've had a ClickOnce app in use for a few months now, but recently started getting an error on my deployment of the latest version. With this latest version I've added a reference to a DLL that I hadn't used before (FTD2XX_NET.dllif it's relevant), and suspect that this is related to the issue but I cannot figure out how to fix it.

我已经使用 ClickOnce 应用程序几个月了,但最近在部署最新版本时开始出现错误。在这个最新版本中,我添加了对我以前未使用过的 DLL 的引用(如果相关,则为 FTD2XX_NET.dll),并怀疑这与问题有关,但我不知道如何修复它。

The actual project being deployed references another library project, which is what references the DLL (it references other DLL's but that has worked for months and they haven't changed). Following thesethreadsI've tried deleting my "Local Settings/Apps" folder and rebooting multiple times, as well as recreating the project and deploying to a different location. The error exists on multiple machines so I do not suspect it's user profile corruption. Here is the full error I'm given:

正在部署的实际项目引用了另一个库项目,该项目引用了 DLL(它引用了其他 DLL,但它已经工作了几个月并且它们没有改变)。按照这些线程,我尝试删除我的“本地设置/应用程序”文件夹并重新启动多次,以及重新创建项目并部署到不同的位置。该错误存在于多台机器上,所以我不怀疑这是用户配置文件损坏。这是我给出的完整错误:

PLATFORM VERSION INFO
    Windows             : 5.1.2600.196608 (Win32NT)
    Common Language Runtime     : 4.0.30319.261
    System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
    clr.dll             : 4.0.30319.261 (RTMGDR.030319-2600)
    dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
    dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
    Deployment url          : file://nt_server/prog/Publish/Digipot%20Utility/Digipot%20Utility.application
    Deployment Provider url     : file://nt_server/Prog/Publish/Digipot%20Utility/Digipot%20Utility.application
    Application url         : file://nt_server/prog/Publish/Digipot%20Utility/Application%20Files/Digipot%20Utility_1_0_0_72/Digipot%20Utility.exe.manifest

IDENTITIES
    Deployment Identity     : Digipot Utility.application, Version=1.0.0.72, Culture=neutral, PublicKeyToken=1e3769a7c667fbc1, processorArchitecture=msil
    Application Identity        : Digipot Utility.exe, Version=1.0.0.72, Culture=neutral, PublicKeyToken=1e3769a7c667fbc1, processorArchitecture=msil, type=win32

APPLICATION SUMMARY
    * Installable application.

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of \nt_server\prog\Publish\Digipot Utility\Digipot Utility.application 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
    * [3/14/2012 10:17:15 AM] : Activation of \nt_server\prog\Publish\Digipot Utility\Digipot Utility.application has started.
    * [3/14/2012 10:17:15 AM] : Processing of deployment manifest has successfully completed.
    * [3/14/2012 10:17:15 AM] : Installation of the application has started.
    * [3/14/2012 10:17:15 AM] : Processing of application manifest has successfully completed.
    * [3/14/2012 10:17:17 AM] : Found compatible runtime version 2.0.50727.
    * [3/14/2012 10:17:17 AM] : Detecting dependent assembly Sentinel.v3.5Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=msil using Sentinel.v3.5Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=msil.
    * [3/14/2012 10:17:17 AM] : Detecting dependent assembly System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=msil using System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=msil.
    * [3/14/2012 10:17:17 AM] : Detecting dependent assembly NationalInstruments.Common.Native, Version=8.6.35.131, Culture=neutral, PublicKeyToken=18CBAE0F9955702A, processorArchitecture=x86 using NationalInstruments.Common.Native, Version=8.9.35.302, Culture=neutral, PublicKeyToken=18cbae0f9955702a, processorArchitecture=x86.
    * [3/14/2012 10:17:17 AM] : Detecting dependent assembly NationalInstruments.Common, Version=8.6.35.131, Culture=neutral, PublicKeyToken=18CBAE0F9955702A, processorArchitecture=msil using NationalInstruments.Common, Version=8.9.35.302, Culture=neutral, PublicKeyToken=18cbae0f9955702a, processorArchitecture=msil.
    * [3/14/2012 10:17:17 AM] : Request of trust and detection of platform is complete.

ERROR DETAILS
    Following errors were detected during this operation.
    * [3/14/2012 10:17:18 AM] System.ArgumentException
        - Value does not fall within the expected range.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Internal.Isolation.IStore.LockApplicationPath(UInt32 Flags, IDefinitionAppId ApId, IntPtr& Cookie)
            at System.Deployment.Application.ComponentStore.LockApplicationPath(DefinitionAppId definitionAppId)
            at System.Deployment.Application.SubscriptionStore.LockApplicationPath(DefinitionAppId definitionAppId)
            at System.Deployment.Application.FileDownloader.PatchFiles(SubscriptionState subState)
            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.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(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.

Thanks in advance, Joseph

提前致谢,约瑟夫

Edit: It seems the problem is spreading. On the second machine I purged all of the ClickOnce files in the "Local Settings/Apps" so I had to reinstall an old program. When I went to do so it gave me the same error. This program was last updated in February. In response I tried totally removing and reinstalling the .NET framework to no avail.

编辑:似乎问题正在蔓延。在第二台机器上,我清除了“本地设置/应用程序”中的所有 ClickOnce 文件,因此我不得不重新安装一个旧程序。当我这样做时,它给了我同样的错误。该程序上次更新是在 2 月份。作为回应,我尝试完全删除并重新安装 .NET 框架,但无济于事。

采纳答案by Fr33dan

So I found a solution, at the advice of the non-"Answer" solutions on this threadI turned off automatic version incrementing and manually updated the Assembly and File version in the Project settings under "Application > Assembly Information..." and it worked.

所以我找到了一个解决方案,根据这个线程上非“答案”解决方案的建议,我关闭了自动版本递增并在“应用程序>程序集信息...”下的项目设置中手动更新程序集和文件版本,它工作。

回答by Micah Armantrout

Looks like it could be several issues take a look and see if any of them help

看起来可能是几个问题,看看是否有帮助

  • Check and see if there is a & in the path of the application
  • 检查应用程序路径中是否有&

http://connect.microsoft.com/VisualStudio/feedback/details/361607/clickonce-application-does-not-install-when-the-deployment-path-includes-ampersand

http://connect.microsoft.com/VisualStudio/feedback/details/361607/clickonce-application-does-not-install-when-the-deployment-path-includes-ampersand

also take a look at this

也看看这个

  • We used to target "any cpu", and had to change it to x86 in order to get it to work on 64-bit machines. For us, this is because we use DirectX, and it only supports 32-bit machines. So even though we put all of the DirectX code in its own project that targeted x86, we had to have our startup project also target x86.
  • 我们曾经针对“任何 cpu”,并且必须将其更改为 x86 才能使其在 64 位机器上工作。对我们来说,这是因为我们使用的是 DirectX,而且它只支持 32 位机器。因此,即使我们将所有 DirectX 代码放在它自己的针对 x86 的项目中,我们也必须让我们的启动项目也针对 x86。

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/

  • It appears to be caused by an unknown change in the .vbproj file. If you have source control, or backups of your files, restoring an old version of the .vbproj file and republishing seems to fix the problem. You may or may not have to uninstall on the target machine if they tried to run the bad publish.
  • 它似乎是由 .vbproj 文件中的未知更改引起的。如果您有源代码控制或文件备份,恢复旧版本的 .vbproj 文件并重新发布似乎可以解决问题。如果目标计算机尝试运行错误的发布,您可能必须也可能不必在目标计算机上卸载。

http://connect.microsoft.com/VisualStudio/feedback/details/437590/value-does-not-fall-within-the-expected-range-click-once-deployment-failure

http://connect.microsoft.com/VisualStudio/feedback/details/437590/value-does-not-fall-within-the-expected-range-click-once-deployment-failure

  • Make sure you don't have any mismatched version numbers on any dlls , or any circular references.
  • 确保在任何 dll 或任何循环引用上没有任何不匹配的版本号。

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/

回答by m1m1k

If you are trying to run the clickonce on a UNC share, it may not work. I was getting the same result as yours above, but I just tried deploying to C:\ instead of our share, and it runs just fine. I know this isn't a solution, but at least it's a clue - not sure if this has to do with Authentication... or something deeper. Man, I wish the error message was more helpful.

如果您尝试在 UNC 共享上运行 clickonce,它可能不起作用。我得到了和你上面一样的结果,但我只是尝试部署到 C:\ 而不是我们的共享,它运行得很好。我知道这不是一个解决方案,但至少它是一个线索 - 不确定这是否与身份验证有关......或更深层次的东西。伙计,我希望错误消息更有帮助。

回答by Stephane Ehret

Platform target: Any CPU (msil) was definitively the problem for me: Setting to x86 solved the problem

平台目标:任何 CPU (msil) 对我来说都是问题:设置为 x86 解决了问题

回答by George Reimer

I switched publish location to C:\Temp. The installed failed but this time told me I had an existing install from another location. After a bit of poking around, I found I could fix the problem by: 1. Use Control Panel to uninstall my application. 2. Delete publish folder contents.

我将发布位置切换到 C:\Temp。安装失败,但这次告诉我我有一个来自另一个位置的现有安装。经过一番摸索,我发现我可以通过以下方式解决问题: 1. 使用控制面板卸载我的应用程序。2. 删除发布文件夹内容。

I haven't been able to figure out what steps actually produce the problem but its gone now for the the time being.

我一直无法弄清楚哪些步骤实际上会产生问题,但它现在暂时消失了。

回答by jaredbaszler

My cure was a bit different. I was only having problems on one of 3 machines at my workplace. After trying most, if not all, of the solutions above I tried this:

我的治疗有点不同。我的工作场所只有 3 台机器中的一台出现问题。在尝试了大部分(如果不是全部)上述解决方案后,我尝试了以下方法:

Cleared out my AppData folder but it was hard to find. Mine was located here:

清除了我的 AppData 文件夹,但很难找到。我的位于这里:

C:\Users\%usernamefolder%\AppData\Local\Apps.0\PN1V0WLG.QB8RVAAAH2.PA9

this portion "PN1V0WLG.QB8\2RVAAAH2.PA9" might be unique to my machine. But in the 2RVAAAH2.PA9 there were some folders whose name started with the first 4 letters of my application name:

这部分“PN1V0WLG.QB8\2RVAAAH2.PA9”可能是我的机器独有的。但是在 2RVAAAH2.PA9 中有一些文件夹的名称以我的应用程序名称的前 4 个字母开头:

Eg. "prog...exe_f9d3a3c4fe2dee3c_0001.0000_none_81c53bb624457ad3"

I went ahead and actually deleted all folders in the 2RVAAAH2.PA9 directory as they all seemed to pertain to my program or references in my program. I could tell some of them were related to Telerik DLLs that I use so I dumped them too.

我继续并实际删除了 2RVAAAH2.PA9 目录中的所有文件夹,因为它们似乎都与我的程序或程序中的引用有关。我可以看出其中一些与我使用的 Telerik DLL 相关,因此我也将它们转储了。

I then re-installed my program and it worked.

然后我重新安装了我的程序,它起作用了。

回答by Bashar

Remove any &from the Folder name if there is any &in the folder name. I was also having same problem for this reason.

&如果文件夹名称中有任何内容,请从文件夹名称中删除任何内容&。由于这个原因,我也遇到了同样的问题。

Reference:Check Here

参考:点此查看

回答by atp9

In case, any one facing similar issue with WPF application, please take a look at my answer here.

如果任何人在 WPF 应用程序中遇到类似问题,请在此处查看我的回答。

回答by Ricky

The workaround is just to uninstall and reinstall the application. I have yet to find a solution to the error itself, and why it happens so randomly. I will release a new version, and it will happen to one other person, and nobody else. I just released a new version a few minutes ago, and it screwed up my version on my machine, and nobody else's. I have yet to figure out a solution, since when I publish it works on most machines, but not on a couple. Has been this way for literally 12 years.

解决方法只是卸载并重新安装应用程序。我还没有找到错误本身的解决方案,以及为什么它会如此随机地发生。我将发布一个新版本,它会发生在另一个人身上,而不会发生在其他人身上。几分钟前我刚刚发布了一个新版本,它在我的机器上搞砸了我的版本,而其他人没有。我还没有想出一个解决方案,因为当我发布它时,它适用于大多数机器,但不适用于几台机器。从字面上看,这种方式已经持续了 12 年。