自动运行 CD 以及使用 .net 平台编写的应用程序
我们正在 .net 上构建一个应用程序,它是一个使用 .net 3.5 的图像查看器应用程序。 该应用程序将与其他图像一起保存在 CD 上。
我的问题是,当您在不包含 .NET Framework 的计算机上插入 CD 时,是否可以自动运行此应用程序。
或者构建从 CD 运行的应用程序的任何其他方法。
We are building an application on .net, And it is an Image Viewer application uses .net 3.5.
And this application will be on a CD along with other images.
My Question is, is it possible to Auto Run this application when you insert a CD on a machine which DOESN'T Contain .NET Frame Work.
Or any other ways of building the application which runs from the CD.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
自动运行是 Windows 的一项功能。它实际上与.NET 没有任何关系。您可以通过将适当的文件放在 CD 的根目录中来使用它。
请参阅: http://en.wikipedia.org/wiki/AutoRun
为了执行 . NET 应用程序但未安装 .NET 框架,请将 Autorun.inf 指向应用程序的安装程序,该安装程序也将部署在 CD 上。
Autorun is a feature of Windows. It does not have anything to do with .NET really. You can use it by placing apropriate files in the root of your CD.
See: http://en.wikipedia.org/wiki/AutoRun
In order to execute a .NET app WITHOUT .NET framework installed, point the Autorun.inf to an installer of you application, which would be deployed on the CD as well.
当应用程序找不到所需的库时,将无法直接运行。
您可以做的是创建一个非 .NET 依赖的引导程序,包括框架安装程序。
因此,当 CD 自动运行时,运行引导程序,引导程序将运行安装程序。安装后,运行该应用程序。
The application will fail to run directly when it cannot find the libraries it need.
What you can do is to create a non-.NET dependent bootstrapper, include the framework installer.
So when the CD auto run, run the bootstrapper, the bootstrapper will run the installer. Once installed, run the application.
不可以,您无法在未安装 .NET Framework 的计算机上运行 .NET 应用程序。在我看来,这是一条硬性规则,也是一条非常直观的规则。不知何故,这个问题仍然被很多人问到。
但自动运行与.NET Framework 无关。它是 Windows 操作系统提供的一项功能,旨在直接从插入的安装介质运行设置/安装程序,而不需要任何类型的用户交互。
因此,您应该做的是为您的.NET 应用程序创建一个安装程序。您可以在 Visual Studio 中执行此操作:只需创建一个安装项目而不是 Windows 窗体应用程序。安装程序将负责检测计算机是否安装了适当版本的 .NET Framework,并在必要时将其与应用程序一起安装。安装引导程序无需安装 .NET Framework 即可运行,因此您可以创建一个
autorun.inf
文件,仅将setup.exe
指定为要启动的应用程序自动地。No, you can't run .NET applications on a computer without the .NET Framework installed. That's a hard rule, and a pretty intuitive one, it seems to me. Somehow, this question still gets asked a lot.
But Auto Run has nothing to do with the .NET Framework. It's a feature provided by the Windows operating system designed to run your setup/installation program directly from the inserted installation medium without requiring any kind of user interaction.
So what you should be doing is creating a setup program for your .NET application. You can do this from within Visual Studio: just create a Setup Project instead of a Windows Forms Application. The setup program will take care of detecting whether or not the computer has the appropriate version of the .NET Framework installed, and installing it if necessary along with the application. The setup bootstrapper will be able to run without the .NET Framework installed, so you can create an
autorun.inf
file that simply specifiessetup.exe
as the application to be launched automatically.我已经使用 mono 来执行此操作几次,不是使用其他答案中提到的静态链接,而是通过在 cd (或其子集)上包含 mono 发行版。 Mono在修改注册表、system32等方面似乎并没有做太多事情。所以在这种情况下你可以进行if的xcopy部署,或者CD部署。你最终会运行 mono.exe
I've used mono to do this a few times, not with the static linking as mentioned in the other answer, but by including the mono distribution on the cd (or a subset of it). Mono doesn't seem to do much in the way of modifying registry, system32, etc. So you can do an xcopy deployment of if, or CD deployment in this case. You'll end up running mono.exe
我认为 Mono 支持某种形式的静态链接,不需要安装。但我自己从未尝试过。
I think Mono supports some form of static linking that doesn't require installation. But I never tried it myself.