From 2e290d26790fbf6701a22839b2892d77f87020bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=B6mer?= <30902964+manuelroemer@users.noreply.github.com> Date: Wed, 14 Apr 2021 21:05:22 +0200 Subject: [PATCH] Update README.md --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b014053..1b789d0 100644 --- a/README.md +++ b/README.md @@ -94,36 +94,36 @@ Please find installation guides and notes for other project types (for example ` 3. **Build the project**
Ensure that the project compiles. If a build error occurs, you will most likely have to update the C# language version (see next step). -4. **Enable usage of the attributes**
+4. **Enable Nullable Reference Types**
Still in your `.csproj` file you need to activate the feature to fully use it. - The following activation sample is what seems to be the most common use case. But do not hesitate to look at my [guides](https://github.com/manuelroemer/Nullable/wiki) for other considerations. + The following activation sample is what seems to be the most common use case. + But do not hesitate to look at my [guides](https://github.com/manuelroemer/Nullable/wiki) for other considerations. ```xml - + net472;netstandard2.0;netstandard2.1;netcoreapp3.0 - + + 8.0 latest - - annotations - - - enable + + + enable ``` - -5. **Build the project and fix warnings**
- If you're not starting a new project you will probably get a lot of warnings now, since your code base is not yet annotated. - If you don't expect to fix all right now, one solution could be to disable the feature in all files before reviewing each file one by one. - For that run the following powershell script to add a `#nullable disable` directive at the top of each file. - - ```PowerShell - Get-ChildItem -Recurse -Filter *.cs | ForEach-Object { - "#nullable disable`n" + (Get-Content $_ -Raw) | Set-Content $_ - } +5. **For WPF users:** + There [have been issues](https://github.com/manuelroemer/Nullable/issues/11) with WPF projects in the past + which resulted in compilation errors, however these have been fixed with the .NET 5.0.102 SDK. + To get Nullable working with your WPF project, ensure that you are using an SDK >= 5.0.102 SDK and then + add the following configuration to your `.csproj` file: + + ```xml + true + true ``` -You should now be ready to play with nullable references and the attributes even when targeting legacy frameworks. +You should now be ready to use Nullable Reference Types and the corresponding attributes even when targeting legacy frameworks. ## Compiler Constants