WiX project to install .NET4 via MSI for Group Policy

The full redistributable for .NET4 is contained in an EXE, which is not suitable for deployment via Group Policy.

One solution I tried, was to use WiX to wrap the EXE inside an MSI file.
___________________________________________________
update - instead use WSUS:
The WiX project failed in test (even though it worked before for Report Viewer 2010!), and right now I don't have the time to debug it.

An alternative approach we are using:  deploy .NET4 via WSUS (Windows Server Update Services).

http://blogs.msdn.com/b/servicing/archive/2010/06/22/net-framework-4-now-available-on-windows-update-wsus.aspx

___________________________________________________
WiX Installer for .NET4 (failed during testing!)
For reference, below, please find the WiX project + a BAT script to test it out.

note: I've deliberately left in a lot of commented out code, in case it helps anyone explore the different options that WiX provides.

Testing:

              - tested MANUALLY (*not* via Group Policy) on Windows XP Pro SP3
              - hardware: Dell Optiplex Dual Core 2.12Ghz, 1 GB RAM
              - time taken to install: 9 minutes
              - installed ok WITH .NET4 already present + WITHOUT .NET4 already present
              - the Microsoft .NET4 redistributable did not need to download any extra files

you can download the FULL Microsoft .NET4 redistributable here:
http://www.microsoft.com/en-us/download/details.aspx?id=17718

also see this post:
http://antipatterns.blogspot.ie/2012/03/wix-project-to-wrap-exe-installer.html

1. WiX project file 
(Product.wxs)

 <?xml version="1.0" encoding="UTF-8"?> 

 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 

  <Product Id="f2be36b5-161a-4789-a2bb-a82864351feb" Name="dotNET4Installer" Language="1033" Version="1.0.0.0" Manufacturer="Odin Consultants Ltd." UpgradeCode="9a5834d7-bd8f-4d24-827f-555d32237c1a"> 

   <Package InstallerVersion="200" Compressed="yes" /> 

   <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> 

   <Directory Id="TARGETDIR" Name="SourceDir"> 

    <Directory Id="ProgramFilesFolder"> 

     <Directory Id="INSTALLLOCATION" Name="dotNET4Installer"> 

      <Component Id="ProductComponent" Guid="FC5F5A12-4F38-4D95-9729-2CAC2127148E"> 

       <!-- TODO: Insert files, registry keys, and other resources here. --> 

       <!-- note: dotNetFx40_Full_x86_x64.exe is the FULL INSTALLER for .NET4 (no internet connection required). 

        Removing dotNET4Installer will remove dotNetFx40_Full_x86_x64.exe but will NOT remove .NET4.  

        This is the desired behaviour. 

        notes from testing: 

        - tested on Windows XP Pro SP3 

        - hardware: Dell Optiplex Dual Core 2.12Ghz, 1 GB RAM 

        - time taken to install: 9 minutes 

        - installed ok WITH .NET4 already present + WITHOUT .NET4 already present 

       --> 

       <File Id="dotNetFx40_Full_x86_x64.exe" Name="dotNetFx40_Full_x86_x64.exe" Source="bin\ThirdParty\NET4_redist__used_in_ComReg\dotNetFx40_Full_x86_x64.exe" DiskId="1" KeyPath="yes" /> 

       <!--run a program at Windows start up:--> 

       <!-- 

       <Registry Id="OdinRV2010.rst" Root="HKMU" Action="write" 

          Key="Software\Microsoft\Windows\CurrentVersion\Run" 

          Name="Odin Report Viewer 2010" 

          Value="[INSTALLDIR]ReportViewer.exe" 

          Type="string" /> 

       --> 

      </Component> 

     </Directory> 

    </Directory> 

   </Directory> 

   <!-- note: for testing, use /passive in place of /q --> 

   <CustomAction Id="RunDotNetInstall" FileKey="dotNetFx40_Full_x86_x64.exe" ExeCommand="/q" Impersonate="no" Execute="deferred" Return="asyncNoWait" /> 

   <!-- note: only one msiexec can run at a time! (otherwise dotNetFx40_Full_x86_x64.exe gets stuck waiting for this msi to exit!) --> 

   <!-- we use 'asyncNoWait' to allows this MSI to exit, which lets dotNetFx40_Full_x86_x64.exe complete--> 

   <InstallExecuteSequence> 

    <!-- OnExit="success" - cannot use this --> 

    <Custom Action="RunDotNetInstall" Before="InstallFinalize"> 

     NOT Installed 

    </Custom> 

    <!-- ScheduleReboot is AFTER the install. Note: this will prompt the user :-( --> 

    <!-- 

    <ScheduleReboot After="InstallFinalize"></ScheduleReboot> 

    --> 

   </InstallExecuteSequence> 

   <Feature Id="ProductFeature" Title="dotNET4Installer" Level="1"> 

    <ComponentRef Id="ProductComponent" /> 

    <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --> 

    <ComponentGroupRef Id="Product.Generated" /> 

   </Feature> 

  </Product> 

 </Wix>  



2. BAT script to simulate action of Group Policy

 REM trying to simulate what group policy does 

 msiexec /I dotNET4Installer.msi /quiet /qn ALLUSERS=1   


Comments