gpt4 book ai didi

c# - 我如何强制使用 exe 构建 DLL,以便只有一个文件?

转载 作者:太空宇宙 更新时间:2023-11-03 18:45:35 26 4
gpt4 key购买 nike

我有一个简单的 C# 应用程序。我希望 DLL 位于 exe 文件的“内部”。我该怎么做?

最佳答案

ILMerge完全符合您的要求


该页面有点误导,ILMerge 根据其 actual webpage 适用于 V3 和 V4 程序集

ILMerge should work just fine with newer versions of .NET. Just use the option: /targetplatform:v4,. For version 3.5, you probably don't need to set the target platform, but you may need to add the v3.5 framework directory as a /lib option so that assemblies from there can be found. (Unless they're in the GAC in which case they'll be found anyway.) To run ILMerge in the v4.0 runtime, use this config file.


从另一个答案的问题中回答你如何使用它

Usage: ilmerge [/lib:directory]* [/log[:filename]] [/keyfile:filename [/delaysign]] [/internalize[:filename]] [/t[arget] :(library|exe|winexe)] [/closed] [/ndebug] [/ver:version] [/copyattrs [/allowMultiple]] [/xmldocs] [/attr:filename] [/ta rgetplatform:[,] | /v1 | /v1.1 | /v2 | /v4] [/useFullPublicKeyForReferences] [/wildcards] [/zeroPe Kind] [/allowDup:type]* [/union] [/align:n] /out:filename [...]

所以 ilmerge/out:Combined.exe mainFile.exe otherDll.dll 适合您的情况,因为大多数默认设置应该没问题

关于c# - 我如何强制使用 exe 构建 DLL,以便只有一个文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4651995/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com