TL; DR:为什么我需要在这个条件组件中使用空 <CreateFolder/>元素才能使其工作?
我正在为一个内部应用程序组装一个简单的基于WiX的安装程序.此安装程序需要部署标准配置文件(普通.NET .config文件),然后使用msiexec在命令行上传递的属性对其进行自定义.
其中一个自定义是仅在已定义RUNTIME属性时才创建特定的应用程序设置.这是WiX组件:
<Component Id="C.Rbnz.Fsis.CollectionPeriodService.exe.config.runtime"
Guid="*">
<Condition>
<![CDATA[RUNTIME]]>
</Condition>
<CreateFolder/>
<util:XmlFile Id="X.Runtime.1"
Action="createElement"
ElementPath="/configuration/appSettings"
File="[#F.Rbnz.Fsis.CollectionPeriodService.exe.config]"
Name="add"
Sequence="2"/>
<util:XmlFile Id="X.Runtime.2"
File="[#F.Rbnz.Fsis.CollectionPeriodService.exe.config]"
ElementPath="/configuration/appSettings/add[\[]not(@key)[\]]"
Action="setValue"
Name="key"
Value="RunTime"
Sequence="3"/>
<util:XmlFile Id="X.Runtime.3"
File="[#F.Rbnz.Fsis.CollectionPeriodService.exe.config]"
ElementPath="/configuration/appSettings/add[\[]@key='RunTime'[\]]"
Action="setValue"
Name="value"
Value="[RUNTIME]"
Sequence="4"/>
</Component>
Run Code Online (Sandbox Code Playgroud)
这正如我想要的那样 - 如果在命令行上指定了RUNTIME,则会msiexec创建新元素; 如果没有,没有任何反应.
为什么我必须<CreateFolder/>在此组件中使用空?
当我试图让这个工作时,我找到了" Wix条件声明 ",它显示了一个工作组件,但没有解释为什么<CreateFolder/>是必要的.
删除<CreateFolder/>给我这个错误:
ICE18:组件的KeyPath:'C.Rbnz.Fsis.CollectionPeriodService.exe.config.runtime'是目录:'INSTALLDIR'.目录/组件对必须在CreateFolders表中列出.
一旦你知道这意味着什么,我相信,这是非常有用的.
我试过了<UIRef Id="WixUI_Minimal" />,但是我得到了"Unisolved to WixUI:WixUIMinimal".我究竟做错了什么?
我知道如何设置文件夹的权限:
<DirectoryRef Id="ProgramFilesFolder">
<Directory Id="PHPFolder" Name="PHP">
<Component Id="PHP_comp" DiskId="1" Guid="*">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
Run Code Online (Sandbox Code Playgroud)
但是,我还需要将权限应用于所有子文件夹.是否可以列出所有文件夹?
我已阅读所有相关主题,但未找到问题的完整答案.
我想将SYSTEM的完全权限和用户组的读取和执行权限授予Program Files下的文件夹.没有更多,没有更少.
我知道有三种方法可以使用WIX为文件夹授予权限,但这些方法对我来说都不是很好,我将解释原因:
1)常规权限元素:
<CreateFolder Directory="Test">
<Permission User="SYSTEM" GenericAll="yes"/>
<Permission User="Users" Domain="[LOCAL_MACHINE_NAME]"
GenericRead="yes" Read="yes" GenericExecute="yes" ChangePermission="yes"/>
</CreateFolder>
Run Code Online (Sandbox Code Playgroud)
问题:它在外部操作系统上失败,因为它不知道"Users"关键字.我也尝试过SID.除此之外,我需要将Permission元素放在Test目录中的每个文件下(但如果这是唯一的情况,我会管理)
2)WixUtilsExtension PermissionEx元素:
<CreateFolder Directory="Test">
<util:PermissionEx User="SYSTEM" GenericAll="yes"/>
<util:PermissionEx User="Users" Domain="[LOCAL_MACHINE_NAME]"
GenericRead="yes" Read="yes" GenericExecute="yes" ChangePermission="yes"/>
</CreateFolder>
Run Code Online (Sandbox Code Playgroud)
问题:该文件夹还保留Program Files文件夹的默认权限.我不能允许.
3)使用Sddl的PermissionEx:
问题:此元素仅在使用MSI 5.0安装时可用.我正在使用安装程序3.01.
我很乐意获得任何解决方案,包括采用自定义操作的解决方案......
问题WiX - 安装Windows服务并授予权限正是我想要做的.首先,我添加了UtilExtension这样的命名空间:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
Run Code Online (Sandbox Code Playgroud)
然后我在ServiceInstall元素中添加了以下内容:
<util:PermissionEx
User="Authenticated Users"
GenericAll="yes"
ServiceChangeConfig="yes"
ServiceEnumerateDependents="yes"
ChangePermission="yes"
ServiceInterrogate="yes"
ServicePauseContinue="yes"
ServiceQueryConfig="yes"
ServiceQueryStatus="yes"
ServiceStart="yes"
ServiceStop="yes" />
Run Code Online (Sandbox Code Playgroud)
最后,编译器向我提供了以下错误消息:
错误1 ServiceInstall元素包含未处理的扩展元素'util:PermissionEx'.请确保已提供" http://schemas.microsoft.com/wix/UtilExtension "命名空间中元素的扩展名.
我还需要做些什么来确保提供元素的扩展吗?我该如何解决?
学习如何创建Wix Booloader,以便我可以使用我的msi安装包安装.NET框架.无论如何,我遇到了一个未处理的扩展元素的错误.代码如下
<?xml version="1.0" encoding="utf-8"?>
<!--
# This comment is generated by WixEdit, the specific commandline
# arguments for the WiX Toolset are stored here.
candleArgs: "<projectfile>" -ext WixBalExtension
lightArgs: "<projectname>.wixobj" -ext WixBalExtension
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle UpgradeCode="80B0ECBE-CAAE-4B6A-9705-49F0232B0C24"
Version="0.0.1">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="Netfx45" />
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<!-- .NET 4.5 only installed if Vista or higher AND it's not already …Run Code Online (Sandbox Code Playgroud) 在我的设置过程中,我提供了使用"Windows身份验证"或"服务器验证"的选项.一切正常,只要我执行"服务器身份验证"并提供db userId和密码,就会安装db.
使用"windows authentication"(在wix中)安装db时我需要做什么?谢谢
我的product.wxs文件:
<Product Id="*" Name="MySetup2" Language="1033" Version="1.0.0.0" Manufacturer="Hewlett-Packard Company" UpgradeCode="bf1da750-c2fe-4026-9d2b-9d291a61a8b5">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Binary Id="success_bmp" SourceFile="$(sys.SOURCEFILEDIR)success.bmp" />
<Binary Id="error_bmp" SourceFile="$(sys.SOURCEFILEDIR)error.bmp" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="MySetup2" Level="1" ConfigurableDirectory="INSTALLDIR">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id='MvcApp'/>
<ComponentRef Id='SqlComponent' />
</Feature>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Binary Id="CreateTableScript" SourceFile="c:\Temp\MyDb.sql" />
<!-- Specify UI -->
<UIRef Id="MyWebUI" />
<!-- .NET Framework 3.0 SP 1 must be installed -->
<Property Id="FRAMEWORKBASEPATH">
<RegistrySearch …Run Code Online (Sandbox Code Playgroud) 我有一个安装程序,配置2个网站,其中一个在根网站下有一些应用程序.顶级站点仅配置为Windows身份验证,如下所示:
<iis:WebSite Id="WebSite"
Description="Application"
Directory="WEBSITE_INSTALLLOCATION"
AutoStart="yes"
ConfigureIfExists="yes"
StartOnInstall="yes">
<iis:WebAddress Id="AllUnassigned" Port="80" />
<iis:WebApplication Id="WebApplication"
Name="Console"
WebAppPool="WebAppPool"/>
<iis:WebDirProperties Id="WebProperties"
AnonymousAccess="no"
WindowsAuthentication="yes"
AuthenticationProviders="NTLM,Negotiate"/>
</iis:WebSite>
Run Code Online (Sandbox Code Playgroud)
然后,安装程序中的其他(可选)组件将声明应用程序/虚拟目录,如下所示:
<iis:WebVirtualDir Id="HelpWebSite" Alias="Help" Directory="ApexHelpDir" WebSite="WebSite">
<iis:WebApplication Id="HelpApp" Name="Help" WebAppPool="WebAppPool"/>
<iis:WebDirProperties Id="HelpProps" AnonymousAccess="yes" WindowsAuthentication="no"/>
</iis:WebVirtualDir>
Run Code Online (Sandbox Code Playgroud)
我看到的行为是我期望的9/10次,但间歇性地安装程序将安装具有匿名身份验证和 Windows身份验证的"网站"站点,而不仅仅是具有匿名身份验证的帮助应用程序.我能想到的唯一解释是,在根网站下添加虚拟目录/应用程序的行为偶尔会导致root继承子身份验证设置以及它自己的身份验证设置.
注意:我试图将此作为wixtoolset.org网站上的错误提出,但在尝试这样做时仍然遇到错误.
我的WiX安装程序与延迟/立即自定义操作联系时遇到问题.请原谅我的英语.
我想将用户输入的一些属性交给延迟的自定义操作.我知道我需要一个立即的自定义操作和"CustomActionData"来做到这一点.我是以这种方式实施的.
二进制文件:
<Binary Id='myAction' SourceFile='.\TemplateGeneration.CA.dll'/>
Run Code Online (Sandbox Code Playgroud)
即时自定义操作:
<CustomAction Id='Datenuebergabe' Property='DoSomething' Value='InstalllocVar=[INSTALLLOCATION]'/>
Run Code Online (Sandbox Code Playgroud)
延迟的自定义操作:
<CustomAction Id='TemplateGenerationInstallKey' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred' Return='check' HideTarget='yes'/>
Run Code Online (Sandbox Code Playgroud)
InstallExecuteSequence
<InstallExecuteSequence>
<Custom Action="Datenuebergabe" Sequence="1399"/>
<Custom Action="TemplateGenerationInstallKey" Before="InstallFinalize"/>
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)
在延迟的自定义操作中调用属性:
string somedata = session.CustomActionData["InstalllocVar"];
TemplateEngineCall(somedata+"templates", "install_key_cmd", somedata+"scripts", "install_key.cmd");
Run Code Online (Sandbox Code Playgroud)
我的问题:如果我尝试安装我的程序就会中断.使用此代码我只能放弃一个属性,但我需要提交多个.
有关信息:当我查看日志文件时,自定义操作调用时会出现System.Collections.Generic.KeyNotFoundException.
为什么这不起作用?好吧,我需要延迟的自定义操作写入"程序文件文件夹".由于所需的权限,需要延迟的自定义操作,并且在延迟之前执行的立即自定义操作应该有助于处理属性.有可能吗?
我希望你明白我的问题是什么,你可以尝试帮助我.
是否可以使用任何wix命令来创建数据库并将用户添加到数据库中?如果是的话,有没有关于如何做到这一点的例子?
wix ×10
wix-extension ×10
wix3.6 ×5
installer ×3
permissions ×2
iis ×1
iis-7.5 ×1
msiexec ×1
wix3 ×1
wix3.5 ×1