在学习时看的文章,
都会在这边放了个安装检测.net framework的方法
https://www.cnblogs.com/stoneniqiu/p/3380805.html
那我不免俗一起来一段安装前检测用法,
只是因为我们HelloWorld专案是用.Net Core的方式 !
而官方文件只有到4.6.2….
哈!好险我有找到使用 core 3.1 的使用方式
https://github.com/wixtoolset/issues/issues/6099
我们先加入参考档案WixUtilExtension.dll
在Wix标签的参考加入
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
然後Bundle标签下面找个地方贴上
<Fragment>
<Variable Name="AspNetCoreRuntime31InstallDir" Value="[ProgramFiles64Folder]dotnet\shared\Microsoft.AspNetCore.App\3.1.0" />
<util:DirectorySearch Id="AspNetCoreRuntime31Installed" Path="[AspNetCoreRuntime31InstallDir]" Variable="AspNetCoreRuntime31Installed" Result="exists" />
<WixVariable Id="AspNetCoreRuntime31WebDetectCondition" Value="AspNetCoreRuntime31Installed" Overridable="yes" />
<WixVariable Id="AspNetCoreRuntime31WebInstallCondition" Value="" Overridable="yes" />
<PackageGroup Id="AspNetCoreRuntime31Web">
<ExePackage
Name="aspnetcore-runtime-3.1.0-win-x64.exe"
InstallCommand="/install /quiet /norestart /log "[AspNetCoreRuntime31Log]""
RepairCommand="/repair /quiet /norestart /log "[AspNetCoreRuntime31Log]""
UninstallCommand="/uninstall /quiet /norestart /log "[AspNetCoreRuntime31Log]""
PerMachine="yes"
DetectCondition="!(wix.AspNetCoreRuntime31WebDetectCondition)"
InstallCondition="!(wix.AspNetCoreRuntime31WebInstallCondition)"
Vital="yes"
Permanent="yes"
Protocol="burn"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/a16689d1-0872-4ef9-a592-406d3038d8f7/cf4f84504385a599f0cb6a5c113ccb34/aspnetcore-runtime-3.1.0-win-x64.exe"
LogPathVariable="AspNetCoreRuntime31Log"
Compressed="no">
<!-- heat.exe payload "aspnetcore-runtime-3.1.0-win-x64.exe" -o "aspnetcore-runtime.wxs" -->
<RemotePayload
CertificatePublicKey="6608A9DBA86701156A4C17CE63BA99BE8B932F8D"
CertificateThumbprint="62009AAABDAE749FD47D19150958329BF6FF4B34"
Description="Microsoft ASP.NET Core 3.1.0 - Shared Framework"
Hash="2DFD4F9EA2E174A7199C40ED3A826886F1E19EF8"
ProductName="Microsoft ASP.NET Core 3.1.0 - Shared Framework"
Size="7811768"
Version="3.1.0.19566" />
</ExePackage>
</PackageGroup>
</Fragment>
<Fragment>
<Variable Name="WindowsDesktopRuntime31InstallDir" Value="[ProgramFiles64Folder]dotnet\shared\Microsoft.WindowsDesktop.App\3.1.0" />
<util:DirectorySearch Id="WindowsDesktopRuntime31Installed" Path="[WindowsDesktopRuntime31InstallDir]" Variable="WindowsDesktopRuntime31Installed" Result="exists" />
<WixVariable Id="WindowsDesktopRuntime31WebDetectCondition" Value="WindowsDesktopRuntime31Installed" Overridable="yes" />
<WixVariable Id="WindowsDesktopRuntime31WebInstallCondition" Value="" Overridable="yes" />
<PackageGroup Id="WindowsDesktopRuntime31Web">
<ExePackage
Name="windowsdesktop-runtime-3.1.0-win-x64.exe"
InstallCommand="/install /quiet /norestart /log "[WindowsDesktopRuntime31Log]""
RepairCommand="/repair /quiet /norestart /log "[WindowsDesktopRuntime31Log]""
UninstallCommand="/uninstall /quiet /norestart /log "[WindowsDesktopRuntime31Log]""
PerMachine="yes"
DetectCondition="!(wix.WindowsDesktopRuntime31WebDetectCondition)"
InstallCondition="!(wix.WindowsDesktopRuntime31WebInstallCondition)"
Vital="yes"
Permanent="yes"
Protocol="burn"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/a1510e74-b31a-4434-b8a0-8074ff31fb3f/b7de8ecba4a14d8312551cfdc745dea1/windowsdesktop-runtime-3.1.0-win-x64.exe"
LogPathVariable="WindowsDesktopRuntime31Log"
Compressed="no">
<!-- heat.exe payload "windowsdesktop-runtime-3.1.0-win-x64.exe" -o "windowsdesktop-runtime.wxs" -->
<RemotePayload
CertificatePublicKey="6608A9DBA86701156A4C17CE63BA99BE8B932F8D"
CertificateThumbprint="62009AAABDAE749FD47D19150958329BF6FF4B34"
Description="Microsoft Windows Desktop Runtime - 3.1.0 (x64)"
Hash="C16F271754879BA78868947486F37871C9F0E40F"
ProductName="Microsoft Windows Desktop Runtime - 3.1.0 (x64)"
Size="54443856"
Version="3.1.0.28315" />
</ExePackage>
</PackageGroup>
</Fragment>
范例给了两个抓Runtime部分的,我们只要用一个就可以了
在Chain标签内在我们主体安装包前 贴上他的写法
而他主要用的方法是去查看Microsoft.AspNetCore.App下有没有建立这个3.1.0的资料夹
<Variable Name="AspNetCoreRuntime31InstallDir" Value="[ProgramFiles64Folder]dotnet\shared\Microsoft.AspNetCore.App\3.1.0" />
我们建置後执行看看!↓↓↓
水唷! 可以看到打包档就会先检测有没有Runtime,没有了话会直接安装Runtime3.1.0後,
才执行接下来主要的安装包部分。
那因为这个是由网路下载的,
如果说有些公司有内外网分离的情况,
我们只好使用预先手动下载的方式,
先下载aspnetcore-runtime-3.1.0-win-x64.exe後放在程序内,
SourceFile指定位置↓↓↓
<PackageGroup Id="AspNetCoreRuntime31Web">
<ExePackage
Name="aspnetcore-runtime-3.1.0-win-x64.exe"
InstallCommand="/install /quiet /norestart /log "[AspNetCoreRuntime31Log]""
RepairCommand="/repair /quiet /norestart /log "[AspNetCoreRuntime31Log]""
UninstallCommand="/uninstall /quiet /norestart /log "[AspNetCoreRuntime31Log]""
PerMachine="yes"
DetectCondition="!(wix.AspNetCoreRuntime31WebDetectCondition)"
InstallCondition="!(wix.AspNetCoreRuntime31WebInstallCondition)"
Vital="yes"
Permanent="yes"
Protocol="burn"
SourceFile="aspnetcore-runtime-3.1.0-win-x64.exe"
LogPathVariable="AspNetCoreRuntime31Log"
Compressed="yes">
</ExePackage>
</PackageGroup>
如果档案想要附加在我们的Bootstrapper.exe
那Compressed 要改为 yes ,这样档案就会附加进去,
若没有想要附加就维持 no,然後档案属性部分改成一律复制
最後移除掉整串RemotePayload 因为这个是由网址下载的情况才需要的。
建置後执行看看吧!
我在这边有测试过Runtime安装,
基本上server 2019 2016 安装上是没问题,2012 必须升级到R2 才可以进行安装,
然後像是我们的专案 CustomAction.dll,Framework是4.6.2的版本,
测试时我也有一并测试,
但exe档包出来的安装包,
基本上就不用担心他有没有Framework的问题,
所以就把检测拔掉了XD
Day20程序码
https://github.com/Aslan7826/defaultMVC/commits/Day20
>>: Day 20 - SwiftUI开发学习4(切换分页)
什麽是 Queue Jobs? 学过资料结构的朋友一定不陌生,queue 是一种先进先出的资料结构。...
接下来我们要针对基本变数型态做一些简单的介绍,以及超级重要的阵列!那这篇先以variables为主。...
在之前的文章或是你在使用 git 的时候相信你一定有看过 branch 这个单字,但 branch ...
https://github.com/PacktPublishing/Machine-Learni...
Abstract Component为一个Spring中给许多模式注解进行声明式配置的注解(Anno...