C# 安装C.net应用程序时从System.Deployment获取的“值不在预期范围内”

C# 安装C.net应用程序时从System.Deployment获取的“值不在预期范围内”,c#,.net,deployment,C#,.net,Deployment,我正在使用Visual Studio 2013中的发布功能将应用程序部署到服务器 运行它生成的setup.exe时,出现无法启动应用程序错误。我尝试了很多方法来解决这个问题,包括: 重新启动机器 正在更改项目设置/应用程序/程序集信息下的文件和程序集版本。。。和禁用自动修订增量每 根据将目标CPU更改为x86 有什么想法吗 下面是详细信息的完整粘贴。。。文件: PLATFORM VERSION INFO Windows : 6.1.7601.65536 (Win32NT)

我正在使用Visual Studio 2013中的发布功能将应用程序部署到服务器

运行它生成的setup.exe时,出现无法启动应用程序错误。我尝试了很多方法来解决这个问题,包括:

重新启动机器 正在更改项目设置/应用程序/程序集信息下的文件和程序集版本。。。和禁用自动修订增量每 根据将目标CPU更改为x86 有什么想法吗

下面是详细信息的完整粘贴。。。文件:

PLATFORM VERSION INFO
Windows             : 6.1.7601.65536 (Win32NT)
Common Language Runtime     : 4.0.30319.17929
System.Deployment.dll       : 4.0.30319.17929 built by: FX45RTMREL
clr.dll             : 4.0.30319.17929 built by: FX45RTMREL
dfdll.dll           : 4.0.30319.17929 built by: FX45RTMREL
dfshim.dll          : 4.0.41209.0 (Main.041209-0000)
申请摘要 *可安装的应用程序

错误摘要

下面是错误的摘要,这些错误的详细信息将在日志的后面列出

* Activation of C:\Users\Administrator\Desktop\bgapp\xmltest.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/31/2014 7:32:14 PM] : Activation of C:\Users\Administrator\Desktop\bgapp\xmltest.application has started.
    * [3/31/2014 7:32:15 PM] : Processing of deployment manifest has successfully completed.
    * [3/31/2014 7:32:15 PM] : Installation of the application has started.
    * [3/31/2014 7:32:15 PM] : Processing of application manifest has successfully completed.
    * [3/31/2014 7:32:16 PM] : Found compatible runtime version 4.0.30319.
    * [3/31/2014 7:32:16 PM] : Request of trust and detection of platform is complete.

ERROR DETAILS
    Following errors were detected during this operation.
    * [3/31/2014 7:32:16 PM] 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)

此服务器是否安装了与您开发此应用程序时使用的相同版本的.NET?开发计算机在“控制面板-程序和功能”下安装了以下Microsoft.NET Framework版本:4.5多目标包;4.5 SDK;4.5.1; 4.5.1多目标包;4.5.1多目标组件;4.5.1 SDK。服务器机器安装了以下版本:4个多目标包;4.5. 我在服务器上运行Windows Update并安装了Microsoft.NET Framework 4.5.1。现在服务器上有两个版本:4个多目标包和4.5。在项目/设置/应用程序下,目标框架为4.5。即使安装了4.5.1,它仍然无法工作。默认情况下,VS2013构建为.NET 4.5.1,而您的服务器可能没有。请尝试返回应用程序并更改编译时使用的.NET版本。当前,该应用程序已设置为目标.NET Framework 4.5。现在我已经在服务器上安装了4.5.1,我应该改为目标.NET Framework 4.5.1吗?如果选择该选项,我会收到一条警告,更改目标框架可能需要手动修改项目文件才能进行构建。我将目标更改为.NET 4.5.1,但仍然遇到相同的问题。
IDENTITIES
    Deployment Identity     : xmltest.application, Version=1.0.1.0, Culture=neutral, PublicKeyToken=7d533deea4ca951b, processorArchitecture=x86
    Application Identity        : xmltest.exe, Version=1.0.1.0, Culture=neutral, PublicKeyToken=7d533deea4ca951b, processorArchitecture=x86, type=win32
* Activation of C:\Users\Administrator\Desktop\bgapp\xmltest.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/31/2014 7:32:14 PM] : Activation of C:\Users\Administrator\Desktop\bgapp\xmltest.application has started.
    * [3/31/2014 7:32:15 PM] : Processing of deployment manifest has successfully completed.
    * [3/31/2014 7:32:15 PM] : Installation of the application has started.
    * [3/31/2014 7:32:15 PM] : Processing of application manifest has successfully completed.
    * [3/31/2014 7:32:16 PM] : Found compatible runtime version 4.0.30319.
    * [3/31/2014 7:32:16 PM] : Request of trust and detection of platform is complete.

ERROR DETAILS
    Following errors were detected during this operation.
    * [3/31/2014 7:32:16 PM] 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.