我正在尝试按照此page上的说明将.Net 4.5.2可再发行组件打包到我的刻录应用程序中。
但它无法在临时刻录位置找到该文件。
根据日志刻录尝试在此处查找文件:
input()
但该文件实际上是在一个临时文件夹中
例如
[0A14:09C4][2015-05-12T16:48:52]w343: Prompt for source of package: NetFx452Redist, payload: NetFx452Redist, path: `C:\Users\simon\Desktop\redist\NDP452-KB2901907-x86-x64-AllOS-ENU.exe`
指示说这样做:
C:\Users\simon\AppData\Local\Temp\{f5207472-d2a0-4b00-b9ee-c535385bde58}\redist\NDP452-KB2901907-x86-x64-AllOS-ENU.exe
如何让Burn查找.net安装程序的正确位置?
答案 0 :(得分:3)
为DotNet框架添加ExePackage元素将起作用,但也可以使用PayloadGroup:
<PayloadGroup Id="NetFx452RedistPayload">
<Payload Name="redist\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
SourceFile="X:\path\to\redists\in\repo\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"/>
<PayloadGroup/>
引用此组,以便它包含在您的有效负载中:
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<PayloadGroupRef Id="NetFx452RedistPayload"/>
您还需要在链中添加对NetFx452Redist的引用:
<Chain>
<PackageGroupRef Id="NetFx452Redist" />
在应用阶段,源将无法解析(除非您在相对于捆绑包名为“redist”的文件夹中有NDP452-KB2901907-x86-x64-AllOS-ENU.exe)。要指向有效负载中包含的NDP452-KB2901907-x86-x64-AllOS-ENU.exe,诀窍是为ResolveSource事件添加事件处理程序。
ResolveSource + = ResolveSourceHandler;
private void ResolveSourceHandler(object sender, ResolveSourceEventArgs args)
{
try
{
//Everything from the "CurrentBundle" class is from my model.
//The model is built from parsing BootstrapperApplicationData.xml.
//Specifically, payload comes from WixPayloadProperties.
var payload = CurrentBundle.PayloadList.FirstOrDefault(x => string.Compare(x.Id, args.PayloadId, StringComparison.OrdinalIgnoreCase) == 0);
var newPayloadPath = (payload != null) ? Path.Combine(CurrentBundle.WorkingFolder, payload.Name) : string.Empty;
if (File.Exists(newPayloadPath))
{
Engine.SetLocalSource(args.PackageOrContainerId, args.PayloadId, newPayloadPath);
args.Result = Result.Retry;
}
else if (File.Exists(args.LocalSource) == false && string.IsNullOrEmpty(args.DownloadSource) == false)
{
args.Result = Result.Download;
}
}
catch (Exception ex)
{
args.Result = Result.Error;
}
}
答案 1 :(得分:2)
您可以通过直接引用.NET安装包来获得更多控制权,而不是引用NetFxExtension
:
<Fragment>
<!-- Value of the 'Release' registry value when .NET 4.5.2 is installed -->
<?define NetFx452MinRelease = 379893 ?>
<!-- Get the release of the .NET V4 framework currently installed -->
<util:RegistrySearch
Id="NETFRAMEWORK4"
Variable="NETFRAMEWORK4"
Root="HKLM"
Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Release"
Result="value" />
<!-- Install .NET 4.5.2 if not already installed -->
<PackageGroup Id="NetFx4FullRedist">
<ExePackage
Id="NetFx4FullRedist"
Cache="no"
Compressed="yes"
InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]""
RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]""
UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]""
PerMachine="yes"
DetectCondition="NETFRAMEWORK4 >= $(var.NetFx452MinRelease)"
Vital="yes"
Permanent="yes"
Protocol="netfx4"
SourceFile="..\..\Binaries\Microsoft\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
Name="Redist\NDP452-KB2901907-x86-x64-AllOS-ENU.exe">
</ExePackage>
</PackageGroup>
</Fragment>
然后在NetFx4FullRedist
:
<chain>..</chain>
<!-- .NET runtime full profile -->
<PackageGroupRef Id="NetFx4FullRedist"/>
我使用了一个变体来将.NET 4客户端可再发行组件包含在我的刻录生成的安装程序应用程序中,没有任何问题。