我使用WixUI_Advanced的自定义偏差,它使用FeaturesDlg选择要安装的组件.其中一个组件需要安装自定义操作,但如果我不安装该功能,我不想运行该自定义操作.是否有某种方法可以查询安装程序会话或某些内容并为我的自定义操作构建条件,以便仅在选择此功能时才会触发?
编辑:我应该澄清一下,我正在寻找可以在.wxs中使用的语言,以确定是否已选择该功能.像这样的东西,只有我没有弥补的真实代码:
<!--NOT REAL CODE-->
<Custom Action="ThingToDoIfFeatureSelected" Before="InstallFinalize">
$(sys.MyFeatureSessionInformation.Level) > 1
</Custom>
Run Code Online (Sandbox Code Playgroud)
我知道这些信息必须在运行时存在于会话中,否则安装程序将无法安装正确的功能,但我找不到任何引用此会话信息的WIX语言的引用.我无法更改自定义操作本身的代码,因此我需要在WIX标记中测试此条件.
上下文:我正在尝试与DocuSign的Connect通知服务集成.我已经使用一个名为DocuSignConnectUpdate的方法设置了一个WCF服务,该方法将DocuSignEnvelopeInformation作为其唯一参数,由DocuSign指定.这个DocuSignEnvelopeInformation对象来自对它们的API的引用,因此它们可以将此对象传递给我的Web服务,并且我确切地知道会发生什么.DocuSign要求我在他们的网站上配置我的服务地址和命名空间.
问题: DocuSign发送的XML就是我所期望的.DocuSignEnvelopeInformation及其子节点位于名称空间" http://www.docusign.net/API/3.0 "中,元素名称与对象名称匹配:
<DocuSignEnvelopeInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.net/API/3.0">
<EnvelopeStatus>...</EnvelopeStatus>
</DocuSignEnvelopeInformation>
Run Code Online (Sandbox Code Playgroud)
但我的Web服务期望在错误的命名空间中使用不同的东西,并使用修改后的元素名称.这就是我的WSDL中定义DocuSignConnectUpdate方法的方法:
<xs:element name="DocuSignConnectUpdate">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="DocuSignEnvelopeInformation" nillable="true" type="tns:DocuSignEnvelopeInformation"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)
这就是我在WSDL中定义DocuSignEnvelopeInformation类型的方式:
<xs:complexType name="DocuSignEnvelopeInformation">
<xs:sequence>
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/System.ComponentModel" name="PropertyChanged" nillable="true" type="q1:PropertyChangedEventHandler"/>
<xs:element name="documentPDFsField" nillable="true" type="tns:ArrayOfDocumentPDF"/>
<xs:element name="envelopeStatusField" nillable="true" type="tns:EnvelopeStatus"/>
<xs:element name="timeZoneField" nillable="true" type="xs:string"/>
<xs:element name="timeZoneOffsetField" type="xs:int"/>
<xs:element name="timeZoneOffsetFieldSpecified" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
像envelopeStatusField这样的元素名称是自动生成的代码中使用的私有变量的名称.公共属性名称与DocuSign发送的xml相匹配.自动生成的代码还使用XmlTypeAttribute使用正确的docusign命名空间标记每个对象.因此,通过查看自动生成的代码,我希望我的服务对输入感到满意,但生成的WSDL是不同的,如上所示,我的服务无法反序列化xml.
一些代码: DocuSignEnvelopeInformation的自动生成声明:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.docusign.net/API/3.0")]
public partial class DocuSignEnvelopeInformation : object, System.ComponentModel.INotifyPropertyChanged {
private EnvelopeStatus envelopeStatusField;
private DocumentPDF[] …
Run Code Online (Sandbox Code Playgroud)