.NET Bootstrap 无需设置 [英] .NET Bootstrap without setup

查看:29
本文介绍了.NET Bootstrap 无需设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要从 CD 运行的 .NET WinForms 应用程序.我需要弄清楚的是,用户是否需要安装 .NET 版本或在必要时安装而不是在安装后运行应用程序.我发现的有关引导的任何信息都涉及应用程序的设置和安装.如果我不安装任何东西,我该怎么做?我会appeciate任何信息..

I have a .NET WinForms application which needs to be run from CD. What I need to figure out is if user has required .NET version installed or install if necessary than run the application after installation. Any info I've found about bootstrapping involves setup and installation of the application. How can I do this if I don't install anything? I'd appeciate any info..

推荐答案

我也曾想过,如果不制作安装程序,您将无法完成很长时间,但事实并非如此.有一个 msbuild 操作,称为 "GenerateBootstrapper".如果您在 Visual Studio 中:

I was also thinking that you can't do it without making an installer for a long time, but that's not true. There is a msbuild action, called "GenerateBootstrapper". If you're in Visual Studio:

  1. 右键单击您的项目
  2. 卸载项目
  3. 编辑您的项目名称.csproj"

然后您可以通过不同的方式添加 GenerateBootstrapper 操作(取决于您要安装的内容).MSDN 给出了一个 .NET 2.0 的例子:

Then you can add GenerateBootstrapper action in different ways (depend on what you want to install). MSDN gives an example for .NET 2.0:

<ItemGroup>
    <BootstrapperFile Include="Microsoft.Net.Framework.2.0">
        <ProductName>Microsoft .NET Framework 2.0</ProductName>
    </BootstrapperFile>
</ItemGroup>

<Target Name="BuildBootstrapper">
    <GenerateBootstrapper
        ApplicationFile="WindowsApplication1.application"
        ApplicationName="WindowsApplication1"
        ApplicationUrl="http://mycomputer"
        BootstrapperItems="@(BootstrapperFile)"
        OutputPath="C:\output" />
</Target>

我没有尝试过这个例子,但我自己尝试过,我可以告诉你,为了在 XP 机器上安装 .NET 4 Client Profile(这是今天最新的稳定 .NET 版本),你需要首先安装 Windows Imaging Component.这就是 VS2010 中包含的标准 .NET4 Client Profile 先决条件在 XP 上失败的原因.所以我写了 我的自己的引导程序.您可以下载我的示例 VS2010 解决方案,它为控制台应用程序创建引导程序.但它要求您安装(只需复制)我的引导程序.下面是步骤:

I didn't try this example, but I tried my own and I can tell you, that in order to install .NET 4 Client Profile (which is the latest stable .NET release for today) on XP machines, you need to install Windows Imaging Component first. That's why standard .NET4 Client Profile prerequisite, included in VS2010, fails on XP. So i wrote my own bootstrapper. You can download my sample VS2010 solution, that creates a bootstrapper for console app. But it requires you to install (just copy) my bootstrapper. So here are the steps:

  1. 下载我的 Windows 成像组件引导程序
  2. 将其解压缩到 %PROGRAMFILES%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
  3. 下载我的 BootstrapperTest 解决方案
  4. 构建解决方案.您将看到它在 \bin\Debug 目录中创建了 BootstrapperTest.exe 和 setup.exe.Setup.exe 是一个引导程序,您可以在没有安装 .NET 的情况下运行它 - 它会为您获取它然后运行 ​​BootstrapperTest.exe.
  5. 如果您想将其作为单个文件分发,我建议使用 ChilkAt Zip2Secure或者它的类似物.Zip2Secure 非常易于使用,希望您不会遇到任何问题.
  1. Download my Windows Imaging Component bootstrapper
  2. Unzip it to %PROGRAMFILES%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
  3. Download my BootstrapperTest solution
  4. Build solution. You'll see that it created BootstrapperTest.exe and setup.exe in \bin\Debug directory. Setup.exe is a bootstrapper, you can run it without .NET installed - it will get it for you and then run BootstrapperTest.exe.
  5. If you want to distribute it as a single file, I recommend using a ChilkAt Zip2Secure or it's analogues. Zip2Secure is very easy to use and I hope you won't have any troubles with it.

这篇关于.NET Bootstrap 无需设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆