将 C# (.NET 2.0) 应用程序部署为可移植应用程序?

发布于 2024-07-30 19:24:00 字数 453 浏览 4 评论 0原文

是否可以将 .NET 2.0 应用程序部署为可移植可执行文件? 这样我的程序就可以在闪存盘中运行,而无需在目标计算机上安装.NET Framework 2.0。 或者是否可以使用所需的 .NET DLL 来分发我的程序,从而无需安装框架?

我知道有一些替代工具可以将我的 .NET exe 转换为单个本机可执行文件,例如 RemoteSoft Salamander、Xenocode Postbuild 和 Thinstall,但不幸的是我买不起。

我还尝试将依赖项嵌入到 Mono 的 mkbundle 中,但它弄乱了我的程序 =\ (没有 XP 视觉风格,破坏了一些控件及其功能)

任何类型的帮助将不胜感激:)

谢谢。

仅供参考:我的 IDE 是 Microsoft Visual C# 2008 Express Edition,以 .NET Framework 2.0 作为目标框架。

Is it possible to deploy a .NET 2.0 application as a portable executable?
So that my program can be ran in a Flash Disk without the .NET Framework 2.0 installed in the target machine. Or maybe is it possible to distribute my program with the required .NET DLLs, so that no framework installation is necessary?

I know that there are some alternative tools to turn my .NET exe into a single native executable like RemoteSoft Salamander, Xenocode Postbuild, and Thinstall, but unfortunately I can't afford one.

I also tried to embed the dependencies with Mono's mkbundle, but it messed my program up =\ (no XP visual style, broke some controls and its functionality)

Any kind of help would be appreciated :)

Thanks.

fyi: my IDE is Microsoft Visual C# 2008 Express Edition with .NET Framework 2.0 as the target framework.

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

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

发布评论

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

评论(4

烦人精 2024-08-06 19:24:01

那么,除了 Salamander 和 Thinstall(现在的 VMWare ThinApp)之类的东西之外,如果您确实想运行 .NET,则必须安装 .NET。

可能无需实际安装即可运行Mono(不是静态链接您的程序) ,但包括闪存驱动器上的 Mono)。 我怀疑这会很棘手,因为您必须告诉运行时有关 GAC 位置等信息。

我在 Mono 常见问题解答中看不到任何与此相关的内容,但您可能想要 ping Mono 邮件列表 - 这听起来可能是一件有趣且有用的事情。

Well, other than things like Salamander and Thinstall (now VMWare ThinApp) you would have to have .NET installed if you really want to run .NET.

It may be possible to run Mono without actually installing it (not statically linking your program, but including Mono on the flash drive). I suspect it would be tricky though, as you'd have to tell the runtime about things like the GAC location.

I can't see anything in the Mono FAQ about this, but you might want to ping a Mono mailing list - it sounds like a potentially interesting and useful thing to be able to do.

梦在夏天 2024-08-06 19:24:01

不; 您需要安装框架或您提到的工具。

可以看看mono的新静态链接器,但仅此而已......

No; you need either the framework installed, or the tools like you have mentioned.

You could potentially look at mono's new static linker, but that is about it...

鸠魁 2024-08-06 19:24:01

我自己没有尝试过,但过程如下:

  • 创建一个 C# 项目。
  • 在解决方案资源管理器中的项目内,有一行“参考”。 单击它附近的加号。 现在您可以看到项目的所有依赖项。 删除所有未使用的引用(删除,并尝试运行/构建。如果可以做到,则表明未使用。如果有错误,则通过添加返回(鼠标右键单击,“添加引用“))。
  • 对于每个引用,转到属性,然后在属性“复制本地”中选择“True”。 对于每个图像、图标...与引用的类似。
  • 重建你的项目。 现在,在您的 Build/Release 文件夹(bin 内)中,您将看到许多 dll 文件。 这些文件包含每个资源的信息。
  • 将文件夹中的所有文件(从步骤 4 开始)复制到新文件夹中。
  • 转到文件夹:“\Microsoft.Net\Framework\”并将文件“mscrolib.dll”复制到步骤 5 中的新文件夹。如果找不到此文件,您可以随时在硬盘中进行搜索其中包含 Windows 文件夹。
  • 现在您的应用程序是可移植的(包含整个文件夹内容)。

-- 来源:http://www.codeproject.com/Tips/392308 /Csharp-Portable-Exe-文件

I have not tried this myself but here's the procedure:

  • Make a C# project.
  • In Solution Explorer, inside your project, there is a line "Reference". Click the plus near it. Now you can see all the dependencies of your project. Delete all references that aren't used (delete, and try to run/build. If it is possible to do it, that it is unused. If there is an error, return it by adding it (right mouse click, "Add Reference")).
  • For each reference, go to Properties, and in the property "Copy Local" choose "True". For each Image, Icon... make like to the referenced.
  • Rebuild you project. Now in your Build/Release folder (inside bin) you will see many dll files. Those files have the information of every resource.
  • Copy all the files in the folder (from step number 4) into a new folder.
  • Go to the folder: "\Microsoft.Net\Framework\" and copy the file "mscrolib.dll" to the new folder from step 5. If you don't find this file, you can always make a search in the Hard Drive which contains Windows folder.
  • Now your app is portable (with the whole folder content).

-- Source: http://www.codeproject.com/Tips/392308/Csharp-Portable-Exe-File

情话墙 2024-08-06 19:24:01

Thinstall 非常昂贵,而且并非在所有情况下都有效。 如果您想在没有安装 .Net 的情况下运行您的应用程序,您可能会遇到麻烦,尽管有一些工具可以做到这一点 Xenocode 有一个工具可以为您完成此操作,并且比 thinstall 便宜。

但如果你问我的意见,使用它们是个坏主意。 更好地说服你的目标市场安装 .Net 2(这在当今几乎是通用的),然后使用一种更便宜的类似混淆器的工具将所有库文件打包到一个文件中(Smartassemble。)

我已经使用 Thinstall 很长时间了,并且我在这项技术上做了很多工作,所以我不会立即离开没有经验。

Well Thinstall is very expensive and it doesn't work in all situations. If you want to run your app without .Net installed you might run into trouble although there are tools that do that Xenocode has a tool that can do this for you and it's cheaper than thinstall.

But if you ask my opinion it's a bad idea to use them. Better convince your target market to install .Net 2 (Which is pretty much universal these days), and then pack all of your library files into one file using a cheaper Obfuscator like tool (There's a good one from Smartassembly.)

I've used Thinstall for a long time, and I've worked on this technology a lot, so I am not shooting off without experience.

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