1

我为开发人员 (C#) 创建了一个复制保护/许可证密钥系统,它修改了开发人员应用程序的主 exe,以添加一个复制保护加载程序,当用户启动应用程序检查他们的许可证密钥时,它首先运行,然后启动实际与服务器验证详细信息后的应用程序。

我想让我的复制保护应用程序获取单击一次部署的输出,添加加载程序并重新创建清单以反映对主 exe 的更改,以便可以使用 Setup.exe 正常安装修改后的应用程序。

我尝试将清单中的程序集名称更改为加载程序的名称,并按照清单中的说明修改 exe 的大小,虽然这解决了最初的错误,但现在的问题是计算的哈希与新的 exe 不匹配我收到以下错误:

    ERROR DETAILS
Following errors were detected during this operation.
* [17/09/2013 11:40:50] System.Deployment.Application.InvalidDeploymentException (HashValidation)
    - Application manifest has either a different computed hash than the one specified or no hash specified at all. 
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
        at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, Uri& appSourceUri, String& appManifestPath)
        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)
    --- Inner Exception ---
    System.Deployment.Application.InvalidDeploymentException (HashValidation)
    - File, SkyCallerPro.exe.manifest, has a different computed hash than specified in manifest.
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.ComponentVerifier.VerifyFileHash(String filePath, Hash hash)
        at System.Deployment.Application.ComponentVerifier.VerifyFileHash(String filePath, HashCollection hashCollection)
        at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)

清单文件的违规部分是这一部分:

    <hash>
    <dsig:Transforms>
      <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
    </dsig:Transforms>
    <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
    <dsig:DigestValue>JARQfZ0fUMiJDudVERGdBFkgqwLLd/gwnyTkZhMQydQ=</dsig:DigestValue>
    </hash>

如何自动重新计算清单文件或绕过此问题?

4

1 回答 1

2

您需要使用 mage 工具对部署清单进行签名。

这在MSDN中都有很好的记录。

于 2013-09-17T10:54:55.030 回答