运行 PostBuildEvent 之前的引导程序
Run Bootstrapper before PostBuildEvent
我有一个 WiX 安装程序项目,如果需要,有一个引导程序任务来安装 .NET。但是它似乎在 PostBuildEvent
之后 运行ning,我需要它在 运行 之前。
有人可以解释一下吗。
相关代码为:
<ItemGroup>
<BootstrapperFile Include=".NETFramework,Version=v4.0,Profile=Client">
<ProductName>.NET Framework 4.0 Client</ProductName>
</BootstrapperFile>
<BootstrapperFile Include="Microsoft.Windows.Installer.4.5">
<ProductName>Windows Installer 4.5</ProductName>
</BootstrapperFile>
</ItemGroup>
<Target Name="Bootstrapper" Inputs="$(OutDir)$(TargetFileName)" Outputs="$(OutDir)\Setup.exe" Condition=" '$(OutputType)'=='package' ">
<GenerateBootstrapper Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper" ApplicationName="EcoButton" ApplicationFile="$(TargetFileName)" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="HomeSite" OutputPath="$(OutputPath)" />
</Target>
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);Bootstrapper</BuildDependsOn>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>cscript "$(ProjectDir)..\EditMsi.vbs" "$(Configuration)" "$(TargetPath)"
cscript "$(ProjectDir)..\BuildSetup.vbs" "1" "$(Configuration)" "$(TargetPath)"
cscript "$(ProjectDir)..\BuildSetup.vbs" "2" "$(Configuration)" "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
这样就可以了。
<Target Name="AfterBuild">
<CallTarget Targets="AfterBuild1" />
<CallTarget Targets="AfterBuild2" />
<CallTarget Targets="AfterBuild3" />
<CallTarget Targets="AfterBuild4" />
</Target>
<Target Name="AfterBuild1" Inputs="$(OutDir)$(TargetFileName)" Outputs="$(OutDir)\Setup.exe" Condition=" '$(OutputType)'=='package' ">
<GenerateBootstrapper Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper" ApplicationName="EcoButton" ApplicationFile="$(TargetFileName)" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="HomeSite" OutputPath="$(OutputPath)" />
</Target>
<Target Name="AfterBuild2">
<Exec Command="cscript "$(ProjectDir)..\EditMsi.vbs" "$(Configuration)" "$(TargetPath)"" />
</Target>
<Target Name="AfterBuild3">
<Exec Command="cscript "$(ProjectDir)..\BuildSetup.vbs" "1" "$(Configuration)" "$(TargetPath)"" />
</Target>
<Target Name="AfterBuild4">
<Exec Command="cscript "$(ProjectDir)..\BuildSetup.vbs" "2" "$(Configuration)" "$(TargetPath)"" />
</Target>
我有一个 WiX 安装程序项目,如果需要,有一个引导程序任务来安装 .NET。但是它似乎在 PostBuildEvent
之后 运行ning,我需要它在 运行 之前。
有人可以解释一下吗。
相关代码为:
<ItemGroup>
<BootstrapperFile Include=".NETFramework,Version=v4.0,Profile=Client">
<ProductName>.NET Framework 4.0 Client</ProductName>
</BootstrapperFile>
<BootstrapperFile Include="Microsoft.Windows.Installer.4.5">
<ProductName>Windows Installer 4.5</ProductName>
</BootstrapperFile>
</ItemGroup>
<Target Name="Bootstrapper" Inputs="$(OutDir)$(TargetFileName)" Outputs="$(OutDir)\Setup.exe" Condition=" '$(OutputType)'=='package' ">
<GenerateBootstrapper Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper" ApplicationName="EcoButton" ApplicationFile="$(TargetFileName)" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="HomeSite" OutputPath="$(OutputPath)" />
</Target>
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);Bootstrapper</BuildDependsOn>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>cscript "$(ProjectDir)..\EditMsi.vbs" "$(Configuration)" "$(TargetPath)"
cscript "$(ProjectDir)..\BuildSetup.vbs" "1" "$(Configuration)" "$(TargetPath)"
cscript "$(ProjectDir)..\BuildSetup.vbs" "2" "$(Configuration)" "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
这样就可以了。
<Target Name="AfterBuild">
<CallTarget Targets="AfterBuild1" />
<CallTarget Targets="AfterBuild2" />
<CallTarget Targets="AfterBuild3" />
<CallTarget Targets="AfterBuild4" />
</Target>
<Target Name="AfterBuild1" Inputs="$(OutDir)$(TargetFileName)" Outputs="$(OutDir)\Setup.exe" Condition=" '$(OutputType)'=='package' ">
<GenerateBootstrapper Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper" ApplicationName="EcoButton" ApplicationFile="$(TargetFileName)" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="HomeSite" OutputPath="$(OutputPath)" />
</Target>
<Target Name="AfterBuild2">
<Exec Command="cscript "$(ProjectDir)..\EditMsi.vbs" "$(Configuration)" "$(TargetPath)"" />
</Target>
<Target Name="AfterBuild3">
<Exec Command="cscript "$(ProjectDir)..\BuildSetup.vbs" "1" "$(Configuration)" "$(TargetPath)"" />
</Target>
<Target Name="AfterBuild4">
<Exec Command="cscript "$(ProjectDir)..\BuildSetup.vbs" "2" "$(Configuration)" "$(TargetPath)"" />
</Target>