I’m currently migrating a project XY which is consumed by a net48 project and a new net8 project.
The project XY needs to implement a method that will only compile for net48 and another method which only compiles for net8.
To make that work, I’m using c# preprocessor commands as shown from Microsoft
Unfortunately Visual Studio 2022 with latest update is showing the code now greyed out. I don’t understand this behavior, because the project itself is using multi targeting by using
net48;net8 in the csproj file.
So actually VS should be able to know that the project multi targets and the code is relevant and thus should not greyed out. Is there anything missing to make it work?
>Solution :
you need to select your current environment with the drop down menu directly located above your editor, like this:
If i would select net48, it’d look like this:
Selecting net8.0 results in it being colored

