12

可能重复:
.NET windows 应用程序,可以将其压缩为单个 .exe 吗?

要运行我需要的位于 Debug and Release 文件夹中的应用AxInterop.WMPLib.dll程序Interop.WMPLib.dll。有没有办法将这些 dll 包含到 exe 中,这样我的应用程序只能在一个文件中使用?

4

6 回答 6

19

只要您的 DLL 是 .NET 程序集,ILMerge就应该能够将您的 exe 及其所有依赖项组合到一个文件中。

于 2009-01-25T00:59:18.310 回答
4

您可以使用 boxedapp 或 thinstall 之类的工具...

于 2009-05-19T14:45:28.667 回答
4

我还推荐boxedapp。这是一个很棒的应用程序!

于 2011-11-23T19:08:53.277 回答
0

将它们作为嵌入包含在内。然后,您可以在运行时提取它们。

于 2009-01-25T01:09:34.437 回答
0

是的,我遗漏了写出文件的代码......

FileStream so=new FileStream("c:\\\wherever\\\x.dll",FileMode.Create);

so.Write(buf,0,ssize);

so.Close();

不需要额外的实用程序。

于 2009-01-25T04:45:43.063 回答
-2

例如,将 x.dll 添加到项目并将其 Build Action 设置为 Embedded Resource。

提取:

 string AppPath=Assembly.GetExecutingAssembly().Location;
 Assembly ThisAssembly=Assembly.LoadFrom(AppPath);
 System.IO.Stream fs=ThisAssembly.GetManifestResourceStream("yourproectname.x.dll");
 int ssize=(int)fs.Length;
 byte [] buf=new byte[ssize];
 fs.Read(buf,0,ssize);
 fs.Close();
于 2009-01-25T01:17:16.853 回答