错误启动.NET应用程序编译为目标'任何CPU'

时间:2011-11-02 13:03:03

标签: .net vb.net x86 64-bit

我有一个.NET应用程序,可以与大约30台不同的计算机共享,(32位和64位计算机混合使用)。

编译时,应用程序设置为“任何CPU”。

它在除Windows 7 64位之外的所有计算机上运行良好。

错误消息是:

  

在此操作期间检测到以下错误。 * [2011年11月2日   8:59:40 AM] System.ArgumentException      - 价值不在预期范围内。      - 来源:System.Deployment

经过研究,我发现如果我将目标CPU更改为64位,它在问题机器上运行正常,但不能在32位计算机上运行。

这是否有解决方法?

堆栈追踪:

- 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)

1 个答案:

答案 0 :(得分:5)

在MSDN论坛上找到的高度相关的帖子是 ClickOnce Fails with "Value does not fall within the expected range."