Windows XP,Vista,7默认.net框架? [英] Windows Xp,Vista, 7 Default .net frameworks?

查看:97
本文介绍了Windows XP,Vista,7默认.net框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我想知道每个窗口的默认.net框架。

所以我可以通过c#创建一个安装程序,例如.net 1.0,我想它们会在所有窗口中都很常见吗?

我可以从c#静默安装.net framework4和windows安装程序吗?

解决方案

Microsoft提供了一个全面的FrameWork安装程序,它考虑了Windows它安装的操作系统[ ^ ]。



是的,您可以在带有SP3的Windows XP操作系统上使用FrameWork 4,或者在带SP1的Vista或更高版本等上使用。



上面链接的文章将为您提供所有详细信息。



您关于C#静默安装的声明没有对我来说很有意义。 Visual Studio可以制作一个安装程序:你需要做什么对你有什么帮助?



这是关于CP Q& A的另一个最新问题关于FrameWork的静默安装问(并得到回答):[ ^ ]。



网上有很多资源用于 FrameWork的静默安装:[ ^ ]。



并且,可以选择使用ClickOnce[ ^ ]。请务必查看该文章中标题为浏览器支持的部分[ ^ ]。


这应该有所帮助: http://en.wikipedia .org / wiki / .NET_Framework#Versions [ ^ ] - 它列出了每个操作系统附带的版本 - 如果没有列出操作系统,那么它就没有标准的.NET,例如XP。但这并不意味着特定机器上安装的最高版本如上所列 - 在XP上安装说V3.5是一件简单的事情。最好的办法是检查注册表:

 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP 



如果你迭代子键,它会给你安装的最高版本。



你不能可靠地从C#安装.NET根本不需要:C#要求在ordser中安装.NET才能运行。例如,如果你试图在XP机器上运行一个C#程序,它将无法运行,除非.NET已由其他应用程序安装。



为什么不只是创建一个安装和部署项目?它将确保为您提供所需的.NET版本。


您好朋友我想为我的一个MSI创建一个安装程序。 SQL localdb 2012,我写了这个:





 使用系统; 
使用 System.Collections.Generic;
使用 System.ComponentModel;
使用 System.Data;
使用 System.Drawing;
使用 System.Linq;
使用 System.Text;
使用 System.Windows.Forms;
使用 Microsoft.Win32;
使用 System.IO;
使用 System.Configuration.Install;
使用 System.Diagnostics;

命名空间 EXE
{
public partial class Form1:Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load( object sender,EventArgs e)
{
bool instalResult = ;
timer1.Enabled = true ;
string strResult = n;
strResult = fncCheckRegistry();
bool is64 = CheckCpuArcitecture();
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string strMsix86FileName = appPath + @ \\ \\x86\SqlLocaLDB.msi;
string strMsix64FileName = appPath + @ \\ \\x64\SqlLocalDB_64.msi;
//

if (strResult!= y
{
if (is64 == false
{
instalResult = fncInstal32( strMsix86FileName);
}
}
if (strResult!= y
{
if (is64 == true
{
instalResult = fncInstal32(strMsix64FileName);
}
}
如果(instalResult)timer1.Enabled = false ;
this .Close();
}
//
public bool fncInstal32( string sMSIPath)
{
尝试
{
Console.WriteLine( 开始安装应用程序);
流程流程= 流程();
process.StartInfo.FileName = msiexec.exe;
process.StartInfo.Arguments = string .Format( / qf / i \{0} \ALLUSERS = 1 IACCEPTSQLNCLILICENSETERMS = YES,sMSIPath);
process.Start();
process.WaitForExit();
Console.WriteLine( 应用程序安装成功!);
return true ; // 如果流程成功结束,则返回True
}
catch
{
Console.WriteLine( 有安装应用程序时遇到问题!);
return false ; // 如果流程失败,则返回False
}
}
public bool CheckCpuArcitecture()
{
bool is64 = System.Environment.Is64BitOperatingSystem;
return is64;
}
//
public string fncCheckRegistry()
{
string strResult = n;

使用(RegistryKey Key = Registry.LocalMachine.OpenSubKey( @ < span class =code-string> SOFTWARE \ Microsoftoft\Microsoft SQL Server 2012 Redist \ MSSQL11E.LOCALDB\1033 \ CurrentVersion
))
if (Key!= null
{

strResult = y;
}
else
{
strResult = n;
}

return strResult;
}
bool x = false ;
private void timer1_Tick( object sender,EventArgs e)
{
if (progressBar1.Value == 100 )x = true ;
if (!x)progressBar1.Value ++;
if (progressBar1.Value == 0 )x = ;
if (x)progressBar1.Value--;
}
}
}





这会检查cpu Arcitecture以及我之前是否安装了msi。

问题从这里开始。

我在另一个安装项目中将此项目用作自定义操作中的exe。

在第二个安装项目中我安装.net框架4和Windows安装程序。

但我在设置的提交部分添加了自定义操作。

因此在第一次安装完成后(不完全完成)没有点击按钮)安装sql服务器的第二个设置将开始,但是经过两天思考我的问题后我多么不走运它警告我有两个设置一起工作!!!

什么应该我做朋友吗?你有什么建议吗?

如何在安装结束时关闭基本卸载程序并打开另一个进程?





我找到了答案:



我们创造了一个安装程序类,我们写在其中:











 使用系统; 
使用 System.Collections;
使用 System.Collections.Generic;
使用 System.ComponentModel;
使用 System.Configuration.Install;
使用 System.Linq;


命名空间 OpenWeb
{
[RunInstaller( true )]

public partial class Installer1:System.Configuration.Install.Installer
{
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public 覆盖 void 安装(IDictionary) stateSaver)
{
base .Install(stateSaver);
}

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public 覆盖 void 提交(IDictionary savedState)
{
.Commit(savedState);
System.Diagnostics.Process.Start(Context.Parameters [ TARGETDIR]。ToString ()+ Exe.exe);
// 非常重要!删除所有那些讨厌的临时文件。
base .Dispose();
}

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public 覆盖 void 回滚(IDictionary savedState)
{
.Rollback(savedState);
}

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public 覆盖 void 卸载(IDictionary savedState)
{
.Uninstall(savedState);
}

public Installer1()
{
InitializeComponent();
}
}
}







然后我们创建我们的设置并添加我们的exe文件,我们通过添加主输出来添加安装程序类。

现在我们在提交中添加自定义操作并通过在那里添加主输出来安装。

现在我们将这个/ TARGETDIR =[TARGETDIR] \添加到我们的安装和提交部分的自定义操作数据中。

现在我们建立我们的设置。

享受


Hello friends I want to know the default .net frameworks of every windows.
So i can i make an installer via c# for example .net 1.0 i suppose would be common in all of them?
Can i instal .net framework4 and windows installer from c# silently?

解决方案

Microsoft provides a comprehensive FrameWork installer that takes into account the Windows OS it installs to [^].

Yes, you can use FrameWork 4 on Windows XP OS with SP3, or, on Vista with SP1, or later, etc.

The article linked to above will give you all the details.

Your statement about "silent install" from C# doesn''t quite make sense to me. Visual Studio can make an installer: what doesn''t that do for you that you need done ?

Here''s another recent question on CP Q&A that asked (and was answered) regarding "silent install" of the FrameWork: [^].

There are lots of resources on the net for "silent install" of the FrameWork: [^].

And, there''s the option of using "ClickOnce" [^]. Be sure and examine the section in that article titled "Browser Support" [^].


This should help: http://en.wikipedia.org/wiki/.NET_Framework#Versions[^] - it lists what version shipped with each OS - if the OS is not listed, then it didn;t get .NET as standard, like XP for example. But that doesn''t mean that the highest version installed on a particular machine is as listed - it is a simple matter to install say V3.5 on XP. The best thing to do is to check the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP


If you iterate the sub keys, it will give you the highest version installed.

You can''t install .NET from C# reliably at all: C# requires .NET to be installed in ordser to run. If you try to =run a C# program on an XP machine for example, it will not run at all unless .NET has been installed by a different app.

Why not just create a Setup and Deployment project? It will ensure the required .NET version is present for you.


Hello friends i wanted to create an installer for one of my MSIs. SQL localdb 2012, and i wrote this:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.IO;
using System.Configuration.Install;
using System.Diagnostics;
 
namespace EXE
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            bool instalResult = false;
            timer1.Enabled = true;
            string strResult = "n";
            strResult=fncCheckRegistry();
            bool is64 = CheckCpuArcitecture();
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            string strMsix86FileName = appPath + @"\x86\SqlLocaLDB.msi";
            string strMsix64FileName = appPath + @"\x64\SqlLocalDB_64.msi";
            //

            if (strResult != "y")
            {
                if (is64 == false)
                {
                    instalResult=fncInstal32(strMsix86FileName);
                }
            }
            if (strResult != "y")
            {
                if (is64 == true)
                {
                    instalResult = fncInstal32(strMsix64FileName);
                }
            }
            if (instalResult) timer1.Enabled = false;
            this.Close();
        }
        //
        public bool fncInstal32(string sMSIPath)
        {
            try
            {
                Console.WriteLine("Starting to install application");
                Process process = new Process();
                process.StartInfo.FileName = "msiexec.exe";
                process.StartInfo.Arguments = string.Format(" /qf /i \"{0}\" ALLUSERS=1  IACCEPTSQLNCLILICENSETERMS=YES", sMSIPath);
                process.Start();
                process.WaitForExit();
                Console.WriteLine("Application installed successfully!");
                return true; //Return True if process ended successfully
            }
            catch
            {
                Console.WriteLine("There was a problem installing the application!");
                return false;  //Return False if process ended unsuccessfully
            }
        }
        public bool CheckCpuArcitecture()
        {
            bool is64 = System.Environment.Is64BitOperatingSystem;
            return is64;
        }
        //
        public string fncCheckRegistry()
        {
            string strResult = "n";
 
            using (RegistryKey Key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server 2012 Redist\MSSQL11E.LOCALDB\1033\CurrentVersion"))
                if (Key != null)
                {
 
                    strResult= "y";
                }
                else
                {
                    strResult= "n";
                }
 
            return strResult;
        }
        bool x = false;
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (progressBar1.Value==100) x=true;
            if(!x) progressBar1.Value++;
            if (progressBar1.Value==0) x=false;
            if(x) progressBar1.Value--;
        }
    }
}



This checks cpu Arcitecture and if my msi is installed before.
the problem begins here.
I used this project as an exe in custom actions in a another setup project.
in the second setup project i install .net framework 4 and windows installer.
but i added custom action in the commit part of the setup.
So after the first installation finished(not completely the finish button is not clicked) the second setup that install sql server will begin, but how unlucky i am after two days of thinking on my problem it warns me about having two setup working together!!!
What should i do friends? do you have any suggestion?
How can i close the base uninstaller at the end of installation and open another process?


I have find my answer:

Well we create an installer class and we write this in it:





using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
 

namespace OpenWeb
{
    [RunInstaller(true)]
 
    public partial class Installer1 : System.Configuration.Install.Installer
    {
        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);
        }
 
        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Commit(IDictionary savedState)
        {
            base.Commit(savedState);
            System.Diagnostics.Process.Start(Context.Parameters["TARGETDIR"].ToString() + "Exe.exe");
            // Very important! Removes all those nasty temp files.
            base.Dispose();
        }
 
        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Rollback(IDictionary savedState)
        {
            base.Rollback(savedState);
        }
 
        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);
        }
 
        public Installer1()
        {
            InitializeComponent();
        }
    }
}




then we create our setup and we add our exe file and we add the installer class by adding primary output.
now we add custom action in commit and install by adding primary output there too.
now we add this /TARGETDIR="[TARGETDIR]\" to our custom action data for both of install and commit part.
now we build our setup.
Enjoy


这篇关于Windows XP,Vista,7默认.net框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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