<强>可能重复:结果    .NET Windows应用程序,它可以被压缩成单个.exe?

要运行我的应用程序,我需要AxInterop.WMPLib.dll和位于调试和发布文件夹Interop.WMPLib.dll。有没有什么办法,包括这些dll成exe所以我的应用程序在一个文件只适用?

有帮助吗?

其他提示

您可以像使用boxedapp工具或thinstall ...

我还建议boxedapp。这是伟大的应用程序!

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

是的,我离开了代码写入文件了...

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

so.Write(buf,0,ssize);

so.Close();

不需要额外的工具。

例如,添加x.dll到项目,并设置其生成操作为嵌入的资源。

要提取:

 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();
scroll top