我正在尝试查找SQL服务器的安装目录。以便我可以将用于自定义SSIS任务的dll复制到其中。检测SQL服务器安装目录
下面的代码运行但它不复制我的文件。它不停止,所以我假设它已经发现了一些价值ISSQLSERVERSERVICEINSTALLED
我是wix的新手这是我第一次试图从寄存器中读取。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Daimto OpenWeather for SSIS" Language="1033" Version="1.0.0.0" Manufacturer="DAIMTO" UpgradeCode="84543418-55c4-48c0-b5be-2496fb84ffb6">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="elevated" AdminImage="yes" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="SSISMSSQL" Title="SSIS Components" Display='expand' Level='1'>
<ComponentRef Id='SSISPipelineComponents' />
<ComponentRef Id='SSISConnections' />
</Feature>
<UIRef Id="WixUI_Minimal"/>
</Product>
<!-- Get the directory name-->
<Fragment>
<Property Id="SQLSERVERINSTALLFOLDER">
<RegistrySearch Id='InstallDir'
Type='raw'
Root='HKLM'
Key="SOFTWARE\Microsoft\Microsoft SQL Server\100" Name="VerSpecificRootDir" />
</Property>
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
</Fragment>
<!-- Build directory structure. http://blogs.msdn.com/b/syamp/archive/2012/09/30/wix-search-for-install-path-from-registry.aspx -->
<Fragment>
<Directory Id = "TARGETDIR" Name="SourceDir">
<Directory Id="SQLSERVERINSTALLFOLDER" >
<Directory Id="DTSDir" Name="DTS">
<Directory Id="PIPELINECOMPONENTS" Name="PipelineComponents" />
<Directory Id="CONECTIONS" Name="Connections" />
</Directory>
</Directory>
</Directory>
<!-- Set tarit dir to c: -->
<SetDirectory Id="TARGETDIR" Value="[WindowsVolume]" />
</Fragment>
<!-- copie files. -->
<Fragment>
<ComponentGroup Id="SSISPipelineComponentsgrp" Directory="PIPELINECOMPONENTS">
<Component Id="SSISPipelineComponents" Guid="{51CE96C7-42BF-4CE7-AE88-5C0085868062}" >
<File Id="Daimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" />
</Component>
</ComponentGroup>
<ComponentGroup Id="SSISConnectionsgrp" Directory="CONECTIONS">
<Component Id="SSISConnections" Guid="{8DFFB861-18E4-4E08-8D4E-CAD99911E8A8}" >
<File Id="Daimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
更新1:
- 添加
"InstallPrivileges="elevated""
似乎并没有帮助 - 添加REG的图片。
更新2:
我得到了一些地方。它现在安装在我的Ddrive ....
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:\'.
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding ISSQLSERVERSERVICEINSTALLED property. Its value is 'D:\'.
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding DTS property. Its value is 'D:\DTS\'.
MSI (c) (CC:98) [13:37:09:113]: PROPERTY CHANGE: Adding CONECTIONS property. Its value is 'D:\DTS\Connections\'.
MSI (c) (CC:98) [13:37:09:113]: PROPERTY CHANGE: Adding PIPELINECOMPONENTS property. Its value is 'D:\DTS\PipelineComponents\'.
这使我相信,它没有找到ISSQLSERVERSERVICEINSTALLED
。
更新3:
它现在安装在C盘上。但是它创建了一个名为SQLSERVERINSTALLFOLDER的目录,它没有考虑价值。日志文件说,SQLSERVERINSTALLFOLDER的值是c:我无法弄清楚它是否能够找到注册表值。我尝试添加一个条件,以迫使它失败,但它不是没有
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
可能缺少管理员权限? – Max
我也这么想过。但是,当我点击安装文件时,我可以选择以管理员身份运行。 Windows会弹出并询问权限。 – DaImTo
Witch值在HKLM \ SOFTWARE \ Microsoft \ Microsoft SQL Server \ 100 \ VerSpecificRootDir注册表项上? – Max