Install the Microsoft .NET Framework.
This cookbook supports and requires Chef 14.7+ to take advantage of the reboot
and windows_package
built-in resources.
- Windows 8.1
- Windows 10
- Windows Server 2012 (R1, R2)
- Windows Server 2016
- Windows Server 2019
- Windows Server 2022
Here are the known issues you can encounter with ms_dotnet recipes:
- "Access denied" error on windows_package when running chef via WinRM
Cause
: winrm limitationCommon environment
: knife windows bootstrap, chef-provisioning, test-kitchenTheoretical solution
: try to simulate a local session by wrapping your chef-client call in psexec or a schedule task.Test-Kitchen solution
: with v1.8.0 you can use the winrm-elevated feature that'll run chef via a schedule task
This cookbook provides you two methods to install the major versions of .NET framework.
In common cases you can use the attributes driven recipes provided by this cookbook to setup .NET.
In more custom cases, you might need to control in your own cookbook which .NET version should be installed and when the setup should be performed.
You just need to use the ms_dotnet_framework
custom resource which handles for you the setup mode - feature vs package - and may also install all known patches.
:install
- Install a specific .NET framework
version
- Name attribute. Specify the .NET version to install.include_patches
- Determine whether patches should also be applied (default:true
)feature_source
- Specify custom source for windows features. Only avaiable on NT Version 6.2 (Windows 8/2012) or newer. (default:nil
)perform_reboot
- Determine whether chef should perform required reboot after installing new packages or feature. (default:false
)package_sources
- Specify custom sources URL for windows packages. URL are indexed by their content SHA256 checkum. (default:{}
)require_support
- Determine whether chef should fail when given version is not supported on the current OS (default:false
)
NB:
feature_source
works only on NT Version 6.2 (Windows 8/2012) or newer.
Install .NET 4.8 from custom sources
ms_dotnet_framework '4.8' do
action :install
include_patches true
perform_reboot true
package_sources('68c9986a8dcc0214d909aa1f31bee9fb5461bb839edca996a75b08ddffc1483f' => 'http://my-own.site.com/ndp48-x86-x64-allos-enu.exe')
require_support true
end
This cookbook is mostly attributes driven, default values should be enough for common cases.
NB: because this cookbook is usefull only for windows, attributes are not available on other platforms
Below attributes are accessible via node['ms_dotnet']['ATTRIBUTE_NAME']
and are common to all recipes:
timeout
- Control the execution timeout in seconds of .NET setup packages (default:600
)
Recipes ms_dotnet3
and ms_dotnet4
are controlled by the following attributes accessible via node['ms_dotnet']['vX']['ATTRIBUTE_NAME']
- where X
is the .NET major version:
version
- Specify the .NET version to install (default:3.5.SP1
,4.0
)include_patches
- Determine whether patches should also be applied (default:true
)feature_source
- Specify custom source for windows features. Only avaliable on NT Version 6.2 (Windows 8/2012) or newer. (default:nil
)perform_reboot
- Determine whether chef should perform required reboot after installing new packages or feature. (default:false
)package_sources
- Specify custom sources URL for windows packages. URL are indexed by their content SHA256 checkum. (default:{}
)require_support
- Determine whether chef should fail when given version is not supported on the current OS (default:false
)
NB:
feature_source
works only on NT Version 6.2 (Windows 8/2012) or newer.
Custom node file to install .NET 3.5 SP1 with no patch on a Windows Server 2012R2, using a Windows share for features binaries:
{
"name": "my-node.examples.com",
"run_list": [ "recipe[ms_dotnet::ms_dotnet3" ],
"normal": {
"ms_dotnet": {
"v3": {
"include_patches": "false",
"feature_source": "\\ShareSvr\sxs"
}
}
}
}
Custom node file to install .NET 4.8 from a custom site:
{
"name": "my-node.examples.com",
"run_list": [ "recipe[ms_dotnet::ms_dotnet4" ],
"normal": {
"ms_dotnet": {
"v4": {
"version": "4.8",
"package_sources": {
"68c9986a8dcc0214d909aa1f31bee9fb5461bb839edca996a75b08ddffc1483f": "http://my-own.site.com/ndp48-x86-x64-allos-enu.exe"
}
}
}
}
}
This recipe does nothing.
Each of these recipes allow you to install a specific major version of .NET Framework, just by including the recipe in your node run_list
.
They are attribute driven recipes, please referes to the Attributes
section of this README to know how to control their behavior.
This recipe register .NET 4 to IIS once and only if IIS service exist.
Provides convenients method for the ms_dotnet
cookbook.
Provides a factory to get specific VersionHelper instance.
References all official .NET setup & patches packages supported by this cookbook.
Retrieve a Hash containing .NET setup packages info - name
, checksum
, url
& not_if
guard.
A string not_if
guard represents a custom command to determine whether the package should be installed.
A string Array not_if
guard represents the list of QFE representing or superseding the package.
Determine whether the current node is running on a Core version of Windows.
Determine whether the current node is running on a Server version of Windows.
Determine whether the architecture of the current node is 64-bits.
Base abstract class inheriting from PackageHelper
and providing convenient methods to determine which .NET version the current node supports, and how the setup should be handled.
Get windows features required by the given .NET version
Get installed .NET version on the current node
Get windows package required by the given .NET version
Get windows patches required by the given .NET version
Get windows packages required before installing the given .NET version
Get all .NET versions supported on the current node OS
Subclass of the VersionHelper
, providing helpers for a specific major version of the .NET Framework.
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Authors: Baptiste Courtois ([email protected]), Jeremy Mauro ([email protected])
Copyright 2014-2022, Criteo.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.