2013-08-24 25 views
0

我没有太多(这是我的第一次尝试)WIX的经验,所以我决定在VS 2012中使用SharpSetup模板快速启动并运行。现在我的问题是我需要在用户机器上安装.net以使用该应用程序,但是我在这里找到的所有答案都是关于使用“链”的。再一次,我不知道我会在哪里,但这个。我假设我安装的.net安装程序位于与我的.exe相同的文件夹中,但此时我正在摆动任何内容。您可以看到我尝试过,并且通过将.net安装程序exe包含在与我的项目相同的组中,从而解决了此问题。如果有人可以解释代码中的位置,我实现这个.net检查/安装我非常感谢!在SharpSetup中安装我的表单应用程序之前检查和安装.net 4.0 WIX

这里是我的维克斯:

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
<?include Product.Defines.wxi ?> 



<Fragment> 
<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="ProgramMenuFolder" Name="Programs"> 
    <Directory Id="ProgramMenuDir" Name="!(loc.APPNAME)"> 
     <Component Id="pmd" Guid="{9d848b50-cab5-4f96-abe3-4c551c7335db}"> 
     <RegistryValue Root="HKCU" Key="SOFTWARE\$(var.AppCode)\ProgramMenuDir" Type="string" Value="ProgramMenuDir" KeyPath="yes" /> 
     <RemoveFolder Id="ProgramMenuDirRF" On="uninstall" /> 
     </Component> 
    </Directory> 
    </Directory> 
    <Directory Id="DesktopFolder" Name="Desktop" /> 
    <Directory Id="StartupFolder" Name="Startup" /> 
    <Directory Id="ProgramFilesFolder"> 
    <Directory Id="INSTALLLOCATION" Name="$(var.AppCode)"> 
     <Component Id="MainExecutable" Guid="{bbd95e2b-9f33-4c67-80d9-9b80f3f52001}"> 
     <File Id="MainExecutableFile" Name="SampleApp.exe" Source="..\ProductBuild\sampleFile.txt" KeyPath="yes"> 
      <Shortcut Id="MainExecutableStartMenu" Directory="ProgramMenuDir" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes"/> 
      <Shortcut Id="MainExecutableDesktop" Directory="DesktopFolder" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" /> 
     </File> 
     </Component> 
     <Component Id="SubFeatureExecutable" Guid="{0b30137e-621e-49a1-83bb-d0b50c3834b8}"> 
     <File Id="SubFeatureExecutableFile" Name="SampleLibrary.dll" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
     <Component Id="DocumentationPound" Guid="{006f5e3e-bb68-409c-8c30-37dc82a0a3f9}"> 
     <File Id="DocumentationPoundFile" Name="Pound.currency" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
     <Component Id="DocumentationEuro" Guid="{a1e06fa0-0293-4314-ad3b-5a82b7cde17e}"> 
     <File Id="DocumentationEuroFile" Name="Euro.currency" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
     <Component Id="DocumentationCommon" Guid="{578635b1-b912-428e-b161-3507465bced9}"> 
     <File Id="DocumentationCommonFile" Name="help.exe" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
     <Component Id="DocumentationEnglish" Guid="{434f103e-7be8-49ac-b90b-9675f42e6caa}"> 
     <File Id="DocumentationEnglishFile" Name="English.documentation" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
     <Component Id="DocumentationFrench" Guid="{bd132536-94c6-488d-aa8a-700d4070718f}"> 
     <File Id="DocumentationFrenchFile" Name="French.documentation" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
     <Component Id="DocumentationGerman" Guid="{045e065e-bc43-418d-97fc-701b0d80dca3}"> 
     <File Id="DocumentationGermanFile" Name="German.documentation" Source="..\ProductBuild\sampleFile.txt" Vital="yes" /> 
     </Component> 
    </Directory> 
    </Directory> 
</Directory> 
<DirectoryRef Id="INSTALLLOCATION"> 
    <Component Id="dotNetFx40_Full_x86_x64.exe" Guid="{c5e5282e-dafe-4e51-857f-2648bbcb743c}"> 
    <File Id="fil8a9sd8fa9s8df9a8fs98fd9sfa908sdf" KeyPath="yes" Source="..\ProductBuild\dotNetFx40_Full_x86_x64.exe" /> 
    </Component> 
    <Component Id="EntityFramework.dll" Guid="{C8010F46-05CF-4D73-8F69-6F68176EC558}"> 
    <File Id="fil34ECF92861B5C4F79E50A3EE293AC68A" KeyPath="yes" Source="..\ProductBuild\EntityFramework.dll" /> 
    </Component> 
    <Component Id="EntityFramework.xml" Guid="{C68D3DE4-D338-4C83-96F1-DCF7D1FA1AAC}"> 
    <File Id="fil04EFBF6DC1A33030A49CFCE8889F7E70" KeyPath="yes" Source="..\ProductBuild\EntityFramework.xml" /> 
    </Component> 
    <Component Id="PetesTimeTray.exe" Guid="{C1891D2B-9815-42A3-BCD7-3316F0F28AC7}"> 
    <File Id="fil7AC61C1EB5B94A1F447DA90D87BB454B" KeyPath="yes" Source="..\ProductBuild\PetesTimeTray.exe"> 
     <Shortcut Id="PetesTimeTrayStartMenu" Directory="ProgramMenuDir" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" /> 
     <Shortcut Id="PetesTimeTrayDesktop" Directory="DesktopFolder" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" /> 
     <Shortcut Id="PetesTimeTrayStartUp" Directory="StartupFolder" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" /> 
    </File> 
    </Component> 
    <Component Id="PetesTimeTray.exe.config" Guid="{321EFADC-29DD-4E41-BED0-5B360FAEBBA0}"> 
    <File Id="fil1DC527512D4271328F383F45C1F9229B" KeyPath="yes" Source="..\ProductBuild\PetesTimeTray.exe.config" /> 
    </Component> 
</DirectoryRef> 
<ComponentGroup Id="PetesTimeTrayFiles"> 
    <ComponentRef Id="dotNetFx40_Full_x86_x64.exe" /> 
    <ComponentRef Id="EntityFramework.dll" /> 
    <ComponentRef Id="EntityFramework.xml" /> 
    <ComponentRef Id="PetesTimeTray.exe" /> 
    <ComponentRef Id="PetesTimeTray.exe.config" /> 
</ComponentGroup> 
</Fragment> 
</Wix> 

回答

1

如果.NET Framework是通过链接到NetFxExtension光安装您可以检查。只需添加一个PropertyRef到你想要的。您可以找到这些属性的列表here

说你要确保.NET框架4.0完全存在,然后再安装你的软件,你会在源代码中添加这个地方:

<PropertyRef Id="NETFRAMEWORK40FULL" /> 
<Condition Message=".NET Framework 4.0 Full is not installed."> 
    NETFRAMEWORK40FULL 
</Condition> 

当运行MSI,将LaunchConditions行动将运行并检查是否设置了NETFRAMEWORK40FULL属性。如果是,则继续安装,否则安装失败。

但是,如果您想事先安装.NET Framework,则需要两个WiX项目。一个用于基本的MSI,另一个用于捆绑(这是您听到的链条)。有关于如何做到这一点的教程here

<Bundle> 

    ... 

    <Chain> 
     <PackageGroupRef Id="NetFx40Redist"/> 
     <MsiPackage Id="MyApplication" SourceFile="path to your msi"/> 
    </Chain> 
</Bundle> 

您也必须在此处链接NetFxExtension。列出了可能的.NET软件包列表here

相关问题