简体   繁体   English

在Visual Studio 2012中检查.NET和安装

[英]Check for .NET and Install in Visual Studio 2012

I'm trying to make an installer for a program with user input in a visual studio 2012 environment. 我正在尝试在visual studio 2012环境中为用户输入的程序安装程序。 How do I go about checking for .NET framework when all the options available seem to run .NET (ie VB.NET, C#, F#). 当所有可用选项似乎运行.NET(即VB.NET,C#,F#)时,如何检查.NET框架。

I started a program in VB.NET at the 2.0 framework: 我在2.0框架的VB.NET中启动了一个程序:

For i = 0 To (versionArray.length -1)
    if versionArray(i) = Release then
       exit for
    end if
next i

Where versionArray is an array of the Registry entries in SOFTWARE for .NET 4.5 and Release is the current entry, if it exists. 其中versionArray是SOFTWARE for .NET 4.5中的注册表项数组, Release是当前条目(如果存在)。

This code works but, as I said, it's running on .NET. 这段代码可行,但正如我所说,它在.NET上运行。

You can't run a .NET Application without .NET. 没有.NET,您无法运行.NET应用程序。 You will need to develop your installer with some sort of setup utility. 您需要使用某种设置实用程序来开发安装程序。 With WIX configured correctly in your .NET Project and a setup utility, you can create what's called a CustomAction to further retrieve information at install time. 通过在.NET项目和设置实用程序中正确配置WIX,您可以创建所谓的CustomAction,以便在安装时进一步检索信息。

Note that the setup utility will be the one to detect if the .NET framework is installed and enabled on the system, if not it will proceed with installing it; 请注意,安装实用程序将检测是否在系统上安装并启用了.NET框架,如果不是,它将继续安装它; This will need to be setup ahead of time in your setup tool of choice. 这需要在您选择的设置工具中提前设置。

Refer to this site for lots of great Installer tools and tips: http://installsite.org/ 有关许多出色的安装程序工具和提示,请访问此站点: http//installsite.org/

Here is a nice guide on installing .NET framework programmatically via WiX : http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html 这是一个很好的指南,通过WiX编程方式安装.NET框架: httpWiX

Here are some free setup tools you can use: 以下是一些您可以使用的免费设置工具:

  1. WIX Toolset (Windows Installer XML toolset--lets developers create installers for Windows Installer, the Windows installation engine.) WIX工具集 (Windows Installer XML工具集 - 允许开发人员为Windows Installer创建安装程序,Windows安装引擎。)
  2. Advanced Installer (Free version, very easy to use! Free version includes limited set of features) 高级安装程序 (免费版,非常易于使用!免费版包含一组有限的功能)
  3. Inno Setup Inno设置
  4. NSIS (Open source Setup tool) NSIS (开源设置工具)
  5. Ghost Installer (Free version available) Ghost安装程序 (提供免费版本)
  6. ClickTeam Install Creator (Very Friendly, Free version available) ClickTeam Install Creator (非常友好,免费版)
  7. CreateInstall Free CreateInstall免费

It's not clear what you are doing because there are no setup projects in VS 2012 for building MSI files. 目前还不清楚你在做什么,因为VS 2012中没有用于构建MSI文件的安装项目。 Maybe that means you are writing your own setup program? 也许这意味着你正在编写自己的安装程序? If you want to detect the .NET Frameworks I recommend looking at the code here, C++ 如果你想检测.NET框架,我建议你看看这里的代码,C ++

http://blogs.msdn.com/b/astebner/archive/2013/10/17/10457758.aspx http://blogs.msdn.com/b/astebner/archive/2013/10/17/10457758.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM