# Changing .NET framework version

<!--TODO move this to the problem database? -->

After you updated .NET framework on your operating system, projects you previously created may not work with the following error message:

```text
You must install or update .NET to run this application.

App: /home/u/projects/ind-prog-code/scratchpad/bin/Debug/net9.0/scratchpad
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '9.0.0' (x64)
.NET location: /usr/share/dotnet

The following frameworks were found:
  10.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
 ...
```

## Solution

First we update the .NET version we use.

1. Open your project.
1. In the solution explorer, right click your solution (*not project*). Solution is one level under the project.
1. Right click `Properties`. Project properties should open up.
1. In `Application` properties, on the right of the `Target Framework`, click `...`.
1. Deselect the older version and select the new version, e.g., `net10.0` instead of `net9.0`.
1. Close `Edit Target framework`.
1. Also update `Language Version`, i.e., select `C# latest minor (default)`.

After this you should be able to compile and run your project, even some programming keywords will be red, because they are not recognized. For example `InitializeComponent()` will be red in an Avalonia-based project. To fix this, we have to invalidate caches of Rider:

1. Click the sandwich menu on the top left.
1. Click `Invalidate Caches`.
1. Click `Invalidate and Restart`.

Now, all the functions should be correctly recognized.