title: Cannot install .NET 3.5 on Windows Server 2012 R2 with Chef Test Kitchen
body: <p>I could not find a way to install .NET 3.5 with Chef Test Kitchen on Windows Server 2012 R2.</p>
  
  <p>I can install the framework from the command line with</p>
  
  <p><code>C:\Windows\system32\dism.exe /online /enable-feature /featurename:NetFx3 /norestart /All /source:"C:\Users\admin\AppData\Local\Temp\dotnetfx35.exe"</code></p>
  
  <p>or from the PowerShell prompt with</p>
  
  <p><code>Install-WindowsFeature –name NET-Framework-Core –source "C:\Users\admin\AppData\Local\Temp\dotnetfx35.exe"</code></p>
  
  <p>but if I execute any of the following in chef I get the same error:</p>
  
  <blockquote>
    <p>Deployment Image Servicing and Management tool</p>
    
    <p>Version: 6.3.9600.17031</p>
    
    <p>Image Version: 6.3.9600.17031</p>
    
    <p>Enabling feature(s)</p>
    
    <p>Error: 0x800f0906</p>
    
    <p>The source files could not be downloaded.</p>
    
    <p>Use the "source" option to specify the location of the files that are
    required to restore the feature. For more information on specifying a
    source location, see <a href="http://go.microsoft.com/fwlink" rel="nofollow">http://go.microsoft.com/fwlink</a>....</p>
  </blockquote>
  
  <p>I have copied the dotnetfx35.exe to the user's temp directory at C:\Users\admin\AppData\Local\Temp\dotnetfx35.exe</p>
  
  <p><strong>chef --version</strong></p>
  
  <blockquote>
    <p>Chef Development Kit Version: 0.15.16</p>
    
    <p>chef-client version: 12.11.18</p>
    
    <p>delivery version: master (444effdf9c81908795e88157f01cd667a6c43b5f)</p>
    
    <p>berks version: 4.3.5 kitchen version: 1.7.3</p>
  </blockquote>
  
  <p>The resources I have tried so far:</p>
  
  <p><strong>Using Chocolatey</strong>:</p>
  
  <pre><code>chocolatey_package 'dotnet3.5' do
    options "--allow-empty-checksums --ignore-package-exit-codes"
  end
  </code></pre>
  
  <p><strong>Execute</strong>:</p>
  
  <pre><code>  execute 'install_dot_net_3-5' do
      command "C:\\Windows\\system32\\dism.exe /online /enable-feature /featurename:NetFx3 /norestart /All /source:\"C:\\Users\\admin\\AppData\\Local\\Temp\\dotnetfx35.exe\""
      timeout 9999
    end
  </code></pre>
  
  <p><strong>Batch</strong>:</p>
  
  <pre><code>  batch 'install_dot_net_3-5' do
      code &lt;&lt;-EOH
        C:\\Windows\\system32\\dism.exe /online /enable-feature /featurename:NetFx3 /norestart /All /source:"C:\\Users\\admin\\AppData\\Local\\Temp\\dotnetfx35.exe"
      EOH
      cwd "#{ENV['TEMP']}"
      timeout 9999
    end
  </code></pre>
  
  <p><strong>Powershell script</strong>:</p>
  
  <pre><code>  powershell_script 'install_dot_net_3-5' do
      code &lt;&lt;-EOH
        Install-WindowsFeature –name NET-Framework-Core –source "C:\\Users\\admin\\AppData\\Local\\Temp\\dotnetfx35.exe"
      EOH
    end
  </code></pre>