我正在使用Visual Studio 2019安装项目的扩展名为我的代码创建安装项目。我尝试使用clickonce引导程序将vcredist下载到客户端计算机上,但是它是从网站安装的。我的客户无法在他们的位置使用互联网,因此这不是可行的解决方案。
我尝试为.exe的本地版本创建自己的clickonce软件包,如果它是全新安装而没有先前安装的其他版本的Visual C ++可重新安装,则该软件包可以工作。
这是我的product.xml
<InstallChecks>
<MsiProductCheck
Property="IsMsiInstalled"
Product="{2cbcedbb-f38c-48a3-a3e1-6c6fd821a7f4}"/>
</InstallChecks>
<!-- Defines how to invoke the setup for .NET Framework redist -->
<Commands Reboot="Immediate">
<!--Command for downlevel and future Operating Systems where netfx is not integrated within OS.-->
<Command PackageFile="vc_redist.x64.exe" Arguments=" /q /norestart /ChainingPackage FullX64Bootstrapper">
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<BypassIf Property="IsMsiInstalled"
Compare="ValueGreaterThan" Value="0"/>
<FailIf Property="AdminUser"
Compare="ValueNotEqualTo" Value="True"
String="NotAnAdmin"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="3010" Result="SuccessReboot" />
<DefaultExitCode Result="Fail" FormatMessageFromSystem="false" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
这是我的package.xml
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
>
<!-- Defines a localizable string table for error messages-->
<Strings>
<String Name="DisplayName">Visual C++ "14" Runtime Libraries (x64)</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">You do not have the permissions required to install Visual C++ "14" Runtime Libraries (x64). Please contact your administrator.</String>
<String Name="InvalidOS">Installation of Visual C++ "14" Runtime Libraries (x64) is supported only on x64 machines.</String>
<String Name="GeneralFailure">A failure occurred attempting to install Visual C++ "14" Runtime Libraries (x64).</String>
</Strings>
</Package>
在为已经安装了此软件包(或该软件包的早期版本)的计算机运行安装程序时出现错误。
这是错误。
为(产品名称)安装系统组件时发生错误。在成功安装所有系统组件之前,安装程序无法继续
>Component Visual C++ "14" Runtime Libraries (x64) has failed to install with the following error message:
"Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel. "
The following components failed to install:
- Visual C++ "14" Runtime Libraries (x64)
See the setup log file located at 'C:\Users\(username)\AppData\Local\Temp\VSD5A50.tmp\install.log' for more information.>
这是install.log
>The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [InstallMode] = SameSite {string}
Property: [NTProductType] = 1 {int}
Property: [ProcessorArchitecture] = AMD64 {string}
Property: [VersionNT] = 10.0.0 {version}
Running checks for package 'Microsoft .NET Framework 4.7.2 (x86 and x64)', phase BuildList
Reading value 'Release' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full'
Read integer value 528049
Setting value '528049 {int}' for property 'DotNetFull_Release'
Reading value 'v4' of registry key 'HKLM\SOFTWARE\Microsoft\NET Framework Setup\OS Integration'
Read integer value 1
Setting value '1 {int}' for property 'DotNetFull_OSIntegrated'
Reading value 'ThisVersionInstalled' of registry key 'HKLM\SOFTWARE\Microsoft\Updates\Microsoft .NET Framework 4.7.2\KB4087364'
Unable to read registry value
Not setting value for property 'DotNetFull_MSPDetection'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4054542~31bf3856ad364e35~amd64~~6.2.1.2142'
Unable to read registry value
Not setting value for property 'DotNetFull_Win8X86Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4054542~31bf3856ad364e35~x86~~6.2.1.2142'
Unable to read registry value
Not setting value for property 'DotNetFull_Win8X64Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4054566~31bf3856ad364e35~amd64~~6.3.1.2145'
Unable to read registry value
Not setting value for property 'DotNetFull_Win81X86Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4054566~31bf3856ad364e35~x86~~6.3.1.2145'
Unable to read registry value
Not setting value for property 'DotNetFull_Win81X64Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4054590~31bf3856ad364e35~amd64~~10.0.1.2072'
Unable to read registry value
Not setting value for property 'DotNetFull_Win10AX86Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4054590~31bf3856ad364e35~x86~~10.0.1.2072'
Unable to read registry value
Not setting value for property 'DotNetFull_Win10AX64Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4073120~31bf3856ad364e35~amd64~~10.0.1.2072'
Unable to read registry value
Not setting value for property 'DotNetFull_Win10BX86Identity'
Reading value 'CurrentState' of registry key 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4073120~31bf3856ad364e35~x86~~10.0.1.2072'
Unable to read registry value
Not setting value for property 'DotNetFull_Win10BX64Identity'
The following properties have been set for package 'Microsoft .NET Framework 4.7.2 (x86 and x64)':
Property: [DotNetFull_OSIntegrated] = 1 {int}
Property: [DotNetFull_Release] = 528049 {int}
Running checks for command 'DotNetFX472\NDP472-KB4054530-x86-x64-AllOS-ENU.exe'
Result of running operator 'ValueEqualTo' on property 'InstallMode' and value 'HomeSite': false
Result of running operator 'ValueGreaterThan' on property 'DotNetFull_Release' and value '461808': true
Result of checks for command 'DotNetFX472\NDP472-KB4054530-x86-x64-AllOS-ENU.exe' is 'Bypass'
Running checks for command 'DotNetFX472\NDP472-KB4054531-Web.exe'
Result of running operator 'ValueNotEqualTo' on property 'InstallMode' and value 'HomeSite': true
Result of checks for command 'DotNetFX472\NDP472-KB4054531-Web.exe' is 'Bypass'
'Microsoft .NET Framework 4.7.2 (x86 and x64)' RunCheck result: No Install Needed
Running checks for package 'Microsoft Visual C++ Redistributable 14.0', phase BuildList
Running MsiProductCheck with ProductCode '{2cbcedbb-f38c-48a3-a3e1-6c6fd821a7f4}'
MsiQueryProductState returned '-1'
Setting value '-1 {int}' for property 'VCRedistInstalled'
The following properties have been set for package 'Microsoft Visual C++ Redistributable 14.0':
Property: [VCRedistInstalled] = -1 {int}
Running checks for command 'vcredist_current_x64\vc_redist.x64.exe'
Skipping ByPassIf because Property 'IsMsiInstalled' was not defined
Result of running operator 'ValueNotEqualTo' on property 'AdminUser' and value 'True': false
Result of checks for command 'vcredist_current_x64\vc_redist.x64.exe' is 'Install'
'Microsoft Visual C++ Redistributable 14.0' RunCheck result: Install Needed
EULA for components 'Microsoft Visual C++ Redistributable 14.0' was accepted.
Copying files to temporary directory "C:\Users\(username)\AppData\Local\Temp\VSDA0C2.tmp\"
Copying from 'C:\Users\(username)\(product)\(installer)\Debug\vcredist_current_x64\vc_redist.x64.exe' to 'C:\Users\(username)\AppData\Local\Temp\VSDA0C2.tmp\vcredist_current_x64\vc_redist.x64.exe'
Verifying file integrity of C:\Users\(username)\AppData\Local\Temp\VSDA0C2.tmp\vcredist_current_x64\vc_redist.x64.exe
WinVerifyTrust returned 0
File trusted
Running checks for package 'Microsoft Visual C++ Redistributable 14.0', phase BeforePackage
Running MsiProductCheck with ProductCode '{2cbcedbb-f38c-48a3-a3e1-6c6fd821a7f4}'
MsiQueryProductState returned '-1'
Setting value '-1 {int}' for property 'VCRedistInstalled'
The following properties have been set for package 'Microsoft Visual C++ Redistributable 14.0':
Property: [VCRedistInstalled] = -1 {int}
Running checks for command 'vcredist_current_x64\vc_redist.x64.exe'
Skipping ByPassIf because Property 'IsMsiInstalled' was not defined
Result of running operator 'ValueNotEqualTo' on property 'AdminUser' and value 'True': false
Result of checks for command 'vcredist_current_x64\vc_redist.x64.exe' is 'Install'
'Microsoft Visual C++ Redistributable 14.0' RunCheck result: Install Needed
Verifying file integrity of C:\Users\(username)\AppData\Local\Temp\VSDA0C2.tmp\vcredist_current_x64\vc_redist.x64.exe
WinVerifyTrust returned 0
File trusted
Installing using command 'C:\Users\(username)\AppData\Local\Temp\VSDA0C2.tmp\vcredist_current_x64\vc_redist.x64.exe' and parameters ' /q /norestart /ChainingPackage FullX64Bootstrapper'
Process exited with code 1638
Status of package 'Microsoft Visual C++ Redistributable 14.0' after install is 'InstallFailed'
>
我已经尝试遵循vcredist的Program File(x86)\ Microsoft SDKs ...中的软件包和产品清单,但是将其从网站更改为本地,但这似乎不起作用。遵循Microsoft的教程对我也不起作用。
我认为产品密钥不是正确的产品密钥存在问题。
我需要进行的设置是检查产品或先前版本是否已安装。如果是这样,则跳过设置的这一部分。
感谢指导!
谢谢!