我使用Visual Studio 2013创建了一个工作工具,但是当我发布应用程序以便我的同事可以测试它时,在尝试安装和运行应用程序时,它们总是会出现以下错误:
Strong name signature not valid for this assembly System.IO.Compression.dll
到目前为止,我已经尝试了以下修复,但没有任何工作:
1)我已经使用sn.exe和命令sn -Vr *,publicKeyToken for System.IO.Compression使用其publicKeyToken
2)我已经检查了System.IO.Compression的清单,它确实有一个publicKeyToken
3)在我的项目中,我为System.IO.Compression设置了“Copy Local”和“Specific Version”为TRUE
我不知道它是否相关,但我在构建解决方案时也在VS中收到此消息:
1>c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.IO.Compression.FileSystem.dll : warning CS1684: Reference to type 'System.IO.Compression.CompressionLevel' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll', but it could not be found
1>c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.IO.Compression.FileSystem.dll : warning CS1684: Reference to type 'System.IO.Compression.CompressionLevel' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll', but it could not be found
1>c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.IO.Compression.dll : warning CS1684: Reference to type 'System.IO.Compression.CompressionLevel' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll', but it could not be found
1>c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.IO.Compression.FileSystem.dll : warning CS1684: Reference to type 'System.IO.Compression.CompressionLevel' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll', but it could not be found
以下是错误详情:
Following errors were detected during this operation.
* [6/1/2015 3:19:03 PM] System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Strong name signature not valid for this assembly System.IO.Compression.dll.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ComponentVerifier.VerifyStrongNameAssembly(String filePath, AssemblyManifest assemblyManifest)
at System.Deployment.Application.ComponentVerifier.VerifyComponents()
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并从头开始创建一个新项目,然后从旧项目转移所有内容来解决问题。显然在旧项目中有些东西被破坏了。