You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[.NET Framework 4.7.2 or later](https://dotnet.microsoft.com/download/dotnet-framework)
27
+
-[.NET SDK 6.0 or later](https://dotnet.microsoft.com/download) for .NET console app.
28
+
-[.NET Framework 4.7.2 or later](https://dotnet.microsoft.com/download/dotnet-framework) for .NET Framework console app.
32
29
33
30
## Add a feature flag
34
31
@@ -37,82 +34,19 @@ Add a feature flag called *Beta* to the App Configuration store and leave **Labe
37
34
> [!div class="mx-imgBorder"]
38
35
> 
39
36
40
-
## Create a .NET console app
37
+
## Create a console app
41
38
42
39
### [.NET](#tab/dotnet)
43
40
44
-
You can use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to create a new .NET console app project. The advantage of using the .NET CLI over Visual Studio is that it's available across the Windows, macOS, and Linux platforms. Alternatively, use the preinstalled tools available in the [Azure Cloud Shell](https://shell.azure.com).
45
-
46
-
1. Create a new folder for your project.
47
-
48
-
1. In the new folder, run the following command to create a new .NET console app project:
49
-
50
-
```dotnetcli
51
-
dotnet new console
52
-
```
53
-
54
-
### [.NET Framework](#tab/dotnet-framework)
55
-
56
-
You can use Visual Studio to create a new .NET Framework console app project.
41
+
You can use Visual Studio to create a new console app project.
1. In **Create a new project**, filter on the **Console** project type and click on **Console App (.NET Framework)**. Click **Next**.
61
-
62
-
1. In **Configure your new project**, enter a project name. Under **Framework**, select **.NET Framework 4.8** or higher. Click **Create**.
63
-
64
-
---
65
-
66
-
## Use feature flag
67
-
68
-
### [.NET](#tab/dotnet)
69
-
70
-
1. Add references to the `Microsoft.Extensions.Configuration.AzureAppConfiguration` and `Microsoft.FeatureManagement` NuGet packages by running the following commands.
1. Run the following command to restore packages for your project.
78
-
79
-
```dotnetcli
80
-
dotnet restore
81
-
```
82
-
83
-
1. Open *Program.cs* and add the following statements.
45
+
1. In **Create a new project**, filter on the **Console** project type and select **Console App**. If you want to create a .NET Framework app, please select **Console App (.NET Framework)** instead. Click **Next**.
84
46
85
-
```csharp
86
-
using Microsoft.Extensions.Configuration;
87
-
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
88
-
using Microsoft.FeatureManagement;
89
-
```
90
-
91
-
1. Connect to App Configuration, specifying the `UseFeatureFlags` option so that feature flags are retrieved. Create a `ConfigurationFeatureDefinitionProvider` to provide feature flag definition from the configuration and a `FeatureManager` to evaluate feature flags' state. Then display a message if the `Beta` feature flag is enabled.
92
-
93
-
```csharp
94
-
IConfiguration configuration = new ConfigurationBuilder()
1. In **Configure your new project**, enter a project name. If you are creating a .NET Framework app, please select **.NET Framework 4.7.2** or higher under **Framework**. Click **Create**.
100
48
101
-
IFeatureDefinitionProvider featureDefinitionProvider = new ConfigurationFeatureDefinitionProvider(configuration);
102
-
103
-
IFeatureManager featureManager = new FeatureManager(
104
-
featureDefinitionProvider,
105
-
new FeatureManagementOptions());
106
-
107
-
if (await featureManager.IsEnabledAsync("Beta"))
108
-
{
109
-
Console.WriteLine("Welcome to the beta!");
110
-
}
111
-
112
-
Console.WriteLine("Hello World!");
113
-
```
114
-
115
-
### [.NET Framework](#tab/dotnet-framework)
49
+
## Use the feature flag
116
50
117
51
1. Right-click your project, and select **Manage NuGet Packages**. On the **Browse** tab, search and add the following NuGet packages to your project.
118
52
@@ -127,19 +61,18 @@ You can use Visual Studio to create a new .NET Framework console app project.
127
61
using Microsoft.Extensions.Configuration;
128
62
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
129
63
using Microsoft.FeatureManagement;
130
-
using System.Threading.Tasks;
131
64
```
132
65
133
-
1. Update the `Main` method to connect to App Configuration, specifying the `UseFeatureFlags` option so that feature flags are retrieved. Create a `ConfigurationFeatureDefinitionProvider` to provide feature flag definitions from the configuration and a `FeatureManager` to evaluate feature flags' state. Then display a message if the `Beta` feature flag is enabled.
66
+
1. Connect to App Configuration, specifying the `UseFeatureFlags` option so that feature flags are retrieved. Create a `ConfigurationFeatureDefinitionProvider` to provide feature flag definition from the configuration and a `FeatureManager` to evaluate feature flags' state. Then display a message if the `Beta` feature flag is enabled.
134
67
135
-
```csharp
136
-
public static async Task Main(string[] args)
137
-
{
68
+
### [.NET](#tab/dotnet)
69
+
70
+
```csharp
138
71
IConfiguration configuration = new ConfigurationBuilder()
IFeatureDefinitionProvider featureDefinitionProvider = new ConfigurationFeatureDefinitionProvider(configuration);
105
+
106
+
IFeatureManager featureManager = new FeatureManager(
107
+
featureDefinitionProvider,
108
+
new FeatureManagementOptions());
109
+
110
+
if (await featureManager.IsEnabledAsync("Beta"))
111
+
{
112
+
Console.WriteLine("Welcome to the beta!");
113
+
}
114
+
115
+
Console.WriteLine("Hello World!");
116
+
}
117
+
```
118
+
119
+
---
161
120
162
121
## Build and run the app locally
163
122
164
-
1. Set an environment variable named **ConnectionString** to the connection string of your App Configuration store. If you use the Windows command prompt, run the following command.
123
+
1. Set an environment variable named **ConnectionString** to the connection string of your App Configuration store.
Restart the command prompt to allow the change to take effect. Print the value of the environment variable to validate that it's set properly.
203
-
204
143
---
205
144
206
-
1. Build and run the application.
145
+
1. Restart Visual Studio to allow the change to take effect.
207
146
208
-
### [.NET](#tab/dotnet)
209
-
210
-
- Run the following command to build the console app.
211
-
212
-
```dotnetcli
213
-
dotnet build
214
-
```
215
-
216
-
- After the build successfully completes, run the following command to run the app locally.
217
-
218
-
```dotnetcli
219
-
dotnet run
220
-
```
221
-
222
-
### [.NET Framework](#tab/dotnet-framework)
223
-
224
-
- Restart Visual Studio to allow the change to take effect.
225
-
226
-
- Press Ctrl + F5 to build and run the console app.
227
-
228
-
---
147
+
1. Press Ctrl + F5 to build and run the application.
229
148
230
149
1. You should see the following outputs in the console.
231
150
@@ -245,7 +164,12 @@ You can use Visual Studio to create a new .NET Framework console app project.
245
164
246
165
## Next steps
247
166
248
-
In this quickstart, you created a feature flag in App Configuration and used it with a .NET Framework console app. To learn how to dynamically update feature flags and other configuration values without restarting the application, continue to the next tutorial.
167
+
In this quickstart, you created a feature flag in App Configuration and used it with a console app. To learn how to dynamically update feature flags and other configuration values without restarting the application, continue to the next tutorial.
0 commit comments