如何对 ClickOnce 使用混淆?

发布于 2024-09-13 05:03:06 字数 189 浏览 1 评论 0 原文

如果要发布一个 ClickOnce 版本,它如何被 Dotfuscator

If one will release a ClickOnce version, how can it be obfuscated by Dotfuscator?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

夏尔 2024-09-20 05:03:06

您可以使用商业版本的 Dotfuscator 通过添加部署清单(“foo.application”)作为 Dotfuscator 项目的输入来自动混淆 ClickOnce 应用程序。 Dotfuscator 将允许您向 ClickOnce 应用程序中包含的程序集添加任何必要的排除项,并将创建包含模糊程序集的更新的部署和应用程序清单。

Visual Studio(包括 Visual Studio 2010)中包含的 Dotfuscator 免费版本不具有自动混淆 ClickOnce 应用程序的功能。为了获得正常运行的混淆 ClickOnce 应用程序,您需要重新创建或更新 ClickOnce 清单,因为混淆会更改程序集的签名。

您可以使用 mage.exemageui.exe(包含在 Windows/.NET SDK 中)更新 ClickOnce 清单。如果要使用 mage.exe,您需要注意不能使用 ClickOnce 选项中的“使用 .deploy 文件扩展名”选项,因为它无法识别它。

假设您的 ClickOnce 应用程序名为“Foo”并且版本为 1.0.0.0,您需要遵循的过程是:

  1. 将 ClickOnce 应用程序发布到磁盘上的目录
  2. 运行 Dotfuscator CE 并添加您想要从 bin 目录中进行混淆的程序集 混淆程序
  3. 集。默认情况下,混淆的程序集将被放入名为“Dotfuscated”的子目录中。
  4. 使用 sn.exe 放弃混淆的程序集(仅当您最初对它们进行强命名时)将
  5. 混淆的程序集复制到 ClickOncepublish\Application Files\Foo_1_0_0_0 目录中的程序集的顶部
  6. 更新应用程序清单并放弃它:

    mage.exe -Update "Application Files\Foo_1_0_0_0\Foo.exe.manifest" -CertFile "c:\Foo\foo.pfx" -Password 密码

  7. 更新部署清单并退出:

    mage.exe -Update Foo.application -AppManifest "Application Files\Foo_1_0_0_0\Foo.exe.manifest" -CertFile "c:\Foo\foo.pfx" -Password 密码

您现在拥有使用混淆的有效应用程序和部署清单组件。您还可以使用 MageUI.exe 工具来完成相同的任务(并且它知道如何处理具有 .deploy 扩展名的程序集),但它并不容易实现自动化。

You can use the commercial version of Dotfuscator to automatically obfuscate a ClickOnce application by adding the deployment manifest ("foo.application") as an input to your Dotfuscator project. Dotfuscator will allow you to add any necessary exclusions to the assemblies contained in the ClickOnce application and will create updated deployment and application manifests containing the obfuscated assemblies.

The free version of Dotfuscator included in Visual Studio (including Visual Studio 2010) does not have the feature to automatically obfuscate ClickOnce applications. In order to get a functioning obfuscated ClickOnce application you will need to recreate or update the ClickOnce manifests since obfuscation changes the signatures of the assemblies.

You can use mage.exe or mageui.exe (included in the Windows/.NET SDK) to update the ClickOnce manifests. If you are going to use mage.exe you need to be aware that you cannot use the "Use .deploy file extension" option in your ClickOnce options as it does not recognize it.

Assuming your ClickOnce application is named "Foo" and is at version 1.0.0.0 the process you will want to follow is:

  1. Publish your ClickOnce application to a directory on disk
  2. Run Dotfuscator CE and add the assemblies you want to be obfuscated from the bin directory of your project
  3. Obfuscate the assemblies. The obfuscated assemblies will be put into a subdirectory named "Dotfuscated" by default.
  4. Resign your obfuscated assemblies with sn.exe (only if you initially strong named them)
  5. Copy the obfuscated assemblies over top of the ones in the ClickOnce publish\Application Files\Foo_1_0_0_0 directory
  6. Update the application manifest and resign it:

    mage.exe -Update "Application Files\Foo_1_0_0_0\Foo.exe.manifest" -CertFile "c:\Foo\foo.pfx" -Password password

  7. Update the deployment manifest and resign it:

    mage.exe -Update Foo.application -AppManifest "Application Files\Foo_1_0_0_0\Foo.exe.manifest" -CertFile "c:\Foo\foo.pfx" -Password password

You now have a valid application and deployment manifest using obfuscated assemblies. You can also use the MageUI.exe tool to accomplish the same tasks (and it knows how to handle assemblies with the .deploy extension) but it is not as easy to automate.

遮云壑 2024-09-20 05:03:06

我有一个类似于 Joe Kuemerle 的解决方案,但在发布过程之前。这适用于 Visual StudioMSBuild 命令行。

BeforePublish 目标添加到项目中文件。

<ItemGroup>
    <ClickOnceFiles Include="bin\Release\ClickOnce.*"/>
</ItemGroup>
<Target Name="BeforePublish">
    <Exec Command="{path to dotfuscator}\dotfuscator.exe Dotfuscator.xml" />
    <Exec Command="mage.exe -u bin\Release\ClickOnce.exe.manifest" />
    <Exec Command="mage.exe -u bin\Release\ClickOnce.application -AppManifest bin\Release\ClickOnce.exe.manifest" />
    <Copy SourceFiles="@(ClickOnceFiles)" DestinationFolder="obj\Release" OverwriteReadOnlyFiles="True" />
</Target>

ClickOnce 文件为 ClickOnce.applicationClickOnce.exeClickOnce.exe.manifest。我的 dotfuscator.xml 与项目文件位于同一文件夹中。关键是最后一条命令,将ClickOnce文件复制到obj文件夹中。

I have a solution similar to Joe Kuemerle's, but before the publish process. This works with publish in Visual Studio and MSBuild command line.

Add the BeforePublish target to the project file.

<ItemGroup>
    <ClickOnceFiles Include="bin\Release\ClickOnce.*"/>
</ItemGroup>
<Target Name="BeforePublish">
    <Exec Command="{path to dotfuscator}\dotfuscator.exe Dotfuscator.xml" />
    <Exec Command="mage.exe -u bin\Release\ClickOnce.exe.manifest" />
    <Exec Command="mage.exe -u bin\Release\ClickOnce.application -AppManifest bin\Release\ClickOnce.exe.manifest" />
    <Copy SourceFiles="@(ClickOnceFiles)" DestinationFolder="obj\Release" OverwriteReadOnlyFiles="True" />
</Target>

The ClickOnce files are ClickOnce.application, ClickOnce.exe, and ClickOnce.exe.manifest. My dotfuscator.xml is in the same folder with the project file. The key is the last command, copy the ClickOnce files to the obj folder.

半透明的墙 2024-09-20 05:03:06

我不知道这是否只能在 Visual Studio 的更高版本中实现,但对我来说它工作得很好:

  1. Release 模式下构建可执行文件
  2. 启动您选择的 exe 修改器并修改 处的文件em>obj/Release/<文件名>.exe(注意:不是 bin/ 而是 obj/< /strong>)
  3. 按下 Visual Studio 的立即发布按钮,该按钮假定最后一次构建是最新的
  4. Profit :D

I don't know whether this is only possible in later versions of Visual Studio but for me it works perfectly:

  1. Build the executable in Release mode
  2. Start the exe-modificator of your choice and modify the file at obj/Release/<filename>.exe (notice: not bin/ but obj/)
  3. Push the Publish Now button of Visual Studio which assumes the last build were up-to-date
  4. Profit :D
十年不长 2024-09-20 05:03:06

是的,这些是兼容的技术。 ClickOnce 只是专注于将应用程序及其关联的二进制文件部署到目标计算机。 Dotfuscator 可以分离 DLL 和 EXE 文件。只要您在发布应用程序之前运行 Dotfuscator,它们就会一起工作。

Yes, these are compatible technologies. ClickOnce simply focuses on the deployment of an application and its associated binaries to a target machine. Dotfuscator offuscates the DLL and EXE files. They will work together so long as you run Dotfuscator before publishing the application.

超可爱的懒熊 2024-09-20 05:03:06

如果您使用的是 VS2010,它附带的 Dotfuscator 会混淆文件,然后为您重新签署清单。 [编辑——这不是真的,除非你购买完整版;它的工作方式与 VS2008 类似。]

如果您使用 VS2008,则需要发布文件,然后混淆文件,然后使用 Mage 或 MageUI 重新签署清单。

If you are using VS2010, the Dotfuscator that comes with it will obfuscate the files and then re-sign the manifests for you. [Edit -- this is not true unless you buy the full version; it works just like VS2008.]

If you are using VS2008, you will need to publish, then obfuscate the files, and then re-sign the manifests with Mage or MageUI.

苹果你个爱泡泡 2024-09-20 05:03:06

Deepsea 混淆器与 clickonce 配合使用

The deepsea obfuscator works with clickonce

红尘作伴 2024-09-20 05:03:06

Eziriz .NET Reactor 具有出色的 ClickOnce 集成。

The Eziriz .NET Reactor has an excellent ClickOnce integration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文