在 ClickOnce Publish 上退出清单后无法识别 .exe 文件
.exe file not recognized after resigning the manifest on ClickOnce Publish
我正在使用 MVS 2015 和 .Net Framework 4.5。
我发布了我的 C# WF 应用程序,一切正常,但我必须混淆应用程序文件中的 .exe。
在我这样做之后,很明显,安装程序不再识别 .exe,哈希值不同等等。
我使用提供必要的 .pfx 和密码的 Signtool 退出新的 .exe 添加文件,然后我使用 Mage 更新 .manifest 和 .application according to the second part of this MSDN documentation。
一切都成功了,但是当我 运行 安装并点击安装时,过了一会儿(大约 80% 的安装进度)我收到一条错误消息,说新的有问题.exe 文件:
PLATFORM VERSION INFO
Windows : 10.0.16299.0 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.7.2556.0 built by: NET471REL1
clr.dll : 4.7.2633.0 built by: NET471REL1LAST_C
dfdll.dll : 4.7.2556.0 built by: NET471REL1
dfshim.dll : 10.0.16299.15 (WinBuild.160101.0800)
SOURCES
Deployment url : file:///E:/share/myApp.application
Application url : file:///E:/share/myApp.exe.manifest
IDENTITIES
Deployment Identity : myApp.exe.application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6500754c4a44ec95, processorArchitecture=msil
Application Identity : myApp.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6500754c4a44ec95, 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 E:\share\myApp.application resulted in exception. Following failure messages were detected:
+ Exception occurred loading manifest from file myApp.exe: the manifest may not be valid or the file could not be opened.
+ Cannot load internal manifest from component file.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [24.03.2018 11:03:32] : Activation of E:\share\myApp.application has started.
* [24.03.2018 11:03:32] : Processing of deployment manifest has successfully completed.
* [24.03.2018 11:03:32] : Installation of the application has started.
* [24.03.2018 11:03:33] : Processing of application manifest has successfully completed.
* [24.03.2018 11:03:35] : Found compatible runtime version 4.0.30319.
* [24.03.2018 11:03:35] : Request of trust and detection of platform is complete.
ERROR DETAILS
Following errors were detected during this operation.
* [24.03.2018 11:03:43] System.Deployment.Application.InvalidDeploymentException (ManifestLoad)
- Exception occurred loading manifest from file myApp.exe: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ManifestLoadExceptionHelper(Exception exception, String filePath)
at System.Deployment.Application.Manifest.AssemblyManifest.LoadFromInternalManifestFile(String filePath)
at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.OnModified()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState, X509Certificate2 clientCertificate)
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, Uri& deploymentUri)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
我做错了什么?我错过了什么? :(
我已经调查了 Marko 应用程序,如果您在使用 .NET Refactor 并且在上面遇到问题,这里是让它工作的解决方法:
- .Net Reactor 在项目
中有一个 Visual Studio Add-In needs installed and configured
- 来自 .Net Reactor 的 Anti ILDASM(默认启用的选项)has to be disabled when obfuscating 以便 MVS 可以执行正确的打包过程
无论如何,如果您要在发布后修改您的程序集,您无论如何都需要重新计算散列。怎么可能:
- 不要使用 Visual Studio 发布引擎生成你
"mage.exe" 提出申请。它让你准备你的来源
首先应用程序,然后创建 ClickOnce 应用程序。
- 从第二次下载中下载实用程序 link [here]。执行并 [选择] 您的文件夹 > 将操作更改为 [更新] > 和 [构建]。无需更多操作。更新操作将重新计算哈希值。
- 如果您的混淆器软件支持命令行参数,那么您可以在 .exe VS 项目属性中添加 "Post-build event" 脚本,它将在 clickonce 构建之前执行。
"Deploying Obfuscated Assemblies" 您可以在此处找到文章:Securing ClickOnce Applications
我正在使用 MVS 2015 和 .Net Framework 4.5。 我发布了我的 C# WF 应用程序,一切正常,但我必须混淆应用程序文件中的 .exe。 在我这样做之后,很明显,安装程序不再识别 .exe,哈希值不同等等。
我使用提供必要的 .pfx 和密码的 Signtool 退出新的 .exe 添加文件,然后我使用 Mage 更新 .manifest 和 .application according to the second part of this MSDN documentation。
一切都成功了,但是当我 运行 安装并点击安装时,过了一会儿(大约 80% 的安装进度)我收到一条错误消息,说新的有问题.exe 文件:
PLATFORM VERSION INFO
Windows : 10.0.16299.0 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.7.2556.0 built by: NET471REL1
clr.dll : 4.7.2633.0 built by: NET471REL1LAST_C
dfdll.dll : 4.7.2556.0 built by: NET471REL1
dfshim.dll : 10.0.16299.15 (WinBuild.160101.0800)
SOURCES
Deployment url : file:///E:/share/myApp.application
Application url : file:///E:/share/myApp.exe.manifest
IDENTITIES
Deployment Identity : myApp.exe.application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6500754c4a44ec95, processorArchitecture=msil
Application Identity : myApp.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6500754c4a44ec95, 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 E:\share\myApp.application resulted in exception. Following failure messages were detected:
+ Exception occurred loading manifest from file myApp.exe: the manifest may not be valid or the file could not be opened.
+ Cannot load internal manifest from component file.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [24.03.2018 11:03:32] : Activation of E:\share\myApp.application has started.
* [24.03.2018 11:03:32] : Processing of deployment manifest has successfully completed.
* [24.03.2018 11:03:32] : Installation of the application has started.
* [24.03.2018 11:03:33] : Processing of application manifest has successfully completed.
* [24.03.2018 11:03:35] : Found compatible runtime version 4.0.30319.
* [24.03.2018 11:03:35] : Request of trust and detection of platform is complete.
ERROR DETAILS
Following errors were detected during this operation.
* [24.03.2018 11:03:43] System.Deployment.Application.InvalidDeploymentException (ManifestLoad)
- Exception occurred loading manifest from file myApp.exe: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ManifestLoadExceptionHelper(Exception exception, String filePath)
at System.Deployment.Application.Manifest.AssemblyManifest.LoadFromInternalManifestFile(String filePath)
at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.OnModified()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState, X509Certificate2 clientCertificate)
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, Uri& deploymentUri)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
我做错了什么?我错过了什么? :(
我已经调查了 Marko 应用程序,如果您在使用 .NET Refactor 并且在上面遇到问题,这里是让它工作的解决方法:
- .Net Reactor 在项目 中有一个 Visual Studio Add-In needs installed and configured
- 来自 .Net Reactor 的 Anti ILDASM(默认启用的选项)has to be disabled when obfuscating 以便 MVS 可以执行正确的打包过程
无论如何,如果您要在发布后修改您的程序集,您无论如何都需要重新计算散列。怎么可能:
- 不要使用 Visual Studio 发布引擎生成你 "mage.exe" 提出申请。它让你准备你的来源 首先应用程序,然后创建 ClickOnce 应用程序。
- 从第二次下载中下载实用程序 link [here]。执行并 [选择] 您的文件夹 > 将操作更改为 [更新] > 和 [构建]。无需更多操作。更新操作将重新计算哈希值。
- 如果您的混淆器软件支持命令行参数,那么您可以在 .exe VS 项目属性中添加 "Post-build event" 脚本,它将在 clickonce 构建之前执行。
"Deploying Obfuscated Assemblies" 您可以在此处找到文章:Securing ClickOnce Applications