Training
Module
Implement feature flags in a cloud-native ASP.NET Core microservices app - Training
This module guides you through implementing a feature flag in an ASP.NET Core microservices app using Azure App Configuration.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article describes the concept of default features, their implications, and strategies for effective management.
Default features are a set of features automatically included when a port is installed, unless explicitly disabled. These features ensure that a library maintains a baseline level of functionality, even as the complexity of its dependency graph increases.
Note
Not all ports contain default features.
Default features provide a user-friendly experience by ensuring essential functionalities are available in libraries with modular features.
For instance, a library capable of extracting various archive formats might have each format as an optional feature. Without default features, the library might not include any extraction algorithm out of the box, complicating initial use.
Packages installed by vcpkg will always include their default features, unless explicitly requested otherwise. This behavior applies to packages required directly by the user through a manifest file or vcpkg install invocation, and to packages required as dependencies.
Add the "default-features": false
attribute to a dependency declaration to disable installation of its default features.
Disabling the automatic installation of default features is only possible for user requested dependencies.
If you want to disable default features for a transitive dependency, you need to promote it to a direct dependency on your project's manifest.
Add the special core
feature as part of the requested features of the packages you want to install.
Note
Similar to how manifest mode works, if you want to disable default features for a transitive dependency; you need to promote it to a direct installation request in your command line.
{
"name": "my-application",
"version": "0.15.2",
"dependencies": [
"extract-any"
]
}
In this scenario, extract-any
is installed with its default features, ensuring immediate functionality.
{
"name": "my-application",
"version": "0.15.2",
"dependencies": [
{
"name": "extract-any",
"default-features": false
}
]
}
Here, extract-any
is installed without its default features, allowing for a tailored setup.
vcpkg install extract-any[core]
Here, extract-any
is installed without its default features by using the special core
feature.
Installing a port with default features (default behavior):
vcpkg install extract-any
installs extract-any
with its default features (extract-any[format-a]
), due to the absence of specific feature requests.
Specifying a feature without disabling defaults:
vcpkg install extract-any[format-b]
leads to the installation of extract-any
with both the specified (format-b
) and default (format-a
) features (extract-any[format-a,format-b]
).
Explicitly disabling default features:
vcpkg install extract-any[core]
installs extract-any
without any default features, as [core]
explicitly excludes them.
Transitive dependencies and default features:
vcpkg install extract-any[format-b] portB
might result in extract-any[format-a,format-b] portB
being installed if portB
depends on extract-any[format-a]
, but does not explicitly disable extract-any
's default features.
Combining ports with varied feature specifications:
vcpkg install extract-any[format-b] portB
installs extract-any[format-a, format-b] portB
, including extract-any
's default features unless explicitly excluded.
Comprehensive disabling of default features:
vcpkg install extract-any[core] portB
ensures that extract-any
is installed with only the explicitly requested features, excluding the defaults.
To effectively manage default features within your projects:
[core]
to disable default features when necessary.vcpkg depend-info <port>
to understand dependency resolutions and adjust your configurations accordingly.For more information, see the following:
Adopting a clear strategy for managing default features will help streamline your project's dependency management, ensuring you include only what's necessary for your application's functionality.
vcpkg feedback
vcpkg is an open source project. Select a link to provide feedback:
Training
Module
Implement feature flags in a cloud-native ASP.NET Core microservices app - Training
This module guides you through implementing a feature flag in an ASP.NET Core microservices app using Azure App Configuration.