NewLife/LuckyClover

[feat]新增net45版本安装助手
大石头 authored at 2024-03-20 19:02:51
4e1a26e
Tree
1 Parent(s) 69d895e
Summary: 4 changed files with 164 additions and 1 deletions.
Modified +0 -1
Added +79 -0
Added +63 -0
Modified +22 -0
Modified +0 -1
diff --git a/Installer/NetRuntime.cs b/Installer/NetRuntime.cs
index 77d72d3..5fb8176 100644
--- a/Installer/NetRuntime.cs
+++ b/Installer/NetRuntime.cs
@@ -5,7 +5,6 @@ using System.IO;
 using System.Net;
 using System.Reflection;
 using System.Security.Cryptography;
-using System.ServiceProcess;
 using Microsoft.Win32;
 using NewLife;
 using NewLife.Log;
Added +79 -0
diff --git a/Installer45/app.manifest b/Installer45/app.manifest
new file mode 100644
index 0000000..2e0ad7a
--- /dev/null
+++ b/Installer45/app.manifest
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+    <security>
+      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+        <!-- UAC 清单选项
+             如果想要更改 Windows 用户帐户控制级别,请使用
+             以下节点之一替换 requestedExecutionLevel 节点。
+
+        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
+        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
+        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
+
+            指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
+            如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
+            元素。
+        -->
+        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
+           Windows 版本的列表。取消评论适当的元素,
+           Windows 将自动选择最兼容的环境。 -->
+
+      <!-- Windows Vista -->
+      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
+
+      <!-- Windows 7 -->
+      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
+
+      <!-- Windows 8 -->
+      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
+
+      <!-- Windows 8.1 -->
+      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
+
+      <!-- Windows 10 -->
+      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+
+    </application>
+  </compatibility>
+
+  <!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
+       自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
+       选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
+       在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
+       
+       将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
+  
+  <application xmlns="urn:schemas-microsoft-com:asm.v3">
+    <windowsSettings>
+      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
+      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
+    </windowsSettings>
+  </application>
+  
+
+  <!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
+  <!--
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity
+          type="win32"
+          name="Microsoft.Windows.Common-Controls"
+          version="6.0.0.0"
+          processorArchitecture="*"
+          publicKeyToken="6595b64144ccf1df"
+          language="*"
+        />
+    </dependentAssembly>
+  </dependency>
+  -->
+
+</assembly>
Added +63 -0
diff --git a/Installer45/Installer45.csproj b/Installer45/Installer45.csproj
new file mode 100644
index 0000000..0e3411c
--- /dev/null
+++ b/Installer45/Installer45.csproj
@@ -0,0 +1,63 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net45</TargetFramework>
+    <AssemblyName>LuckyClover</AssemblyName>
+    <RootNamespace>Installer</RootNamespace>
+    <AssemblyTitle>dotNet安装助手(新生命团队)</AssemblyTitle>
+    <Description>检测并安装主流dotNet运行时,作为应用系统安装前置检测工具</Description>
+    <Company>新生命开发团队</Company>
+    <Copyright>©2002-2024 NewLife</Copyright>
+    <VersionPrefix>1.2</VersionPrefix>
+    <VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
+    <Version>$(VersionPrefix).$(VersionSuffix)</Version>
+    <FileVersion>$(Version)</FileVersion>
+    <AssemblyVersion>$(VersionPrefix).*</AssemblyVersion>
+    <Deterministic>false</Deterministic>
+    <OutputPath>..\Bin\Installer45</OutputPath>
+    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <LangVersion>latest</LangVersion>
+    <UseWindowsForms>true</UseWindowsForms>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+    <ApplicationManifest>app.manifest</ApplicationManifest>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\Installer4\Program.cs" Link="Program.cs" />
+    <Compile Include="..\Installer4\Setting.cs" Link="Setting.cs" />
+    <Compile Include="..\Installer\Advapi32.cs" Link="Advapi32.cs" />
+    <Compile Include="..\Installer\DownloadHelper.cs" Link="DownloadHelper.cs" />
+    <Compile Include="..\Installer\FrmMain.cs" Link="FrmMain.cs" />
+    <Compile Include="..\Installer\FrmMain.Designer.cs" Link="FrmMain.Designer.cs" />
+    <Compile Include="..\Installer\Helper.cs" Link="Helper.cs" />
+    <Compile Include="..\Installer\NetRuntime.cs" Link="NetRuntime.cs" />
+    <Compile Include="..\Installer\VerInfo.cs" Link="VerInfo.cs" />
+    <Compile Include="..\Installer\WindowsService.cs" Link="WindowsService.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Include="..\LuckyClover\res\md5.txt" Link="res\md5.txt" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Include="..\Installer\FrmMain.resx" Link="FrmMain.resx" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="NewLife.Core" Version="10.8.2024.303" />
+    <PackageReference Include="NewLife.Stardust" Version="2.9.2024.218" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Folder Include="res\" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Include="..\LuckyClover\res\CertMgr.Exe" Link="res\CertMgr.Exe" />
+    <EmbeddedResource Include="..\LuckyClover\res\MicrosoftRootCertificateAuthority2011.cer" Link="res\MicrosoftRootCertificateAuthority2011.cer" />
+  </ItemGroup>
+
+</Project>
\ No newline at end of file
Modified +22 -0
diff --git a/LuckyClover.sln b/LuckyClover.sln
index 1d1f1c5..556ead4 100644
--- a/LuckyClover.sln
+++ b/LuckyClover.sln
@@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer", "Installer\Inst
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Installer4", "Installer4\Installer4.csproj", "{6E9F5946-AA92-4B5C-9FBD-5DCB68D6B47D}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Installer45", "Installer45\Installer45.csproj", "{F069422D-992B-4979-922A-D29C19673570}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -142,6 +144,26 @@ Global
 		{6E9F5946-AA92-4B5C-9FBD-5DCB68D6B47D}.Release|x64.Build.0 = Release|Any CPU
 		{6E9F5946-AA92-4B5C-9FBD-5DCB68D6B47D}.Release|x86.ActiveCfg = Release|Any CPU
 		{6E9F5946-AA92-4B5C-9FBD-5DCB68D6B47D}.Release|x86.Build.0 = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|ARM.Build.0 = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|ARM64.Build.0 = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|x64.Build.0 = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Debug|x86.Build.0 = Debug|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|ARM.ActiveCfg = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|ARM.Build.0 = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|ARM64.ActiveCfg = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|ARM64.Build.0 = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|x64.ActiveCfg = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|x64.Build.0 = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|x86.ActiveCfg = Release|Any CPU
+		{F069422D-992B-4979-922A-D29C19673570}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE