Reputation: 1484
Whenever I define a conditional compilation symbol for the debug configuration, the editor view keeps the same portion of active code when I switch from debug to Release configuration. However at runtime it runs as expected.
My csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>STACKOVERFLOW</DefineConstants>
</PropertyGroup>
</Project>
And my code:
public static void Main()
{
#if STACKOVERFLOW
Console.WriteLine("Hello World!");
#else
Console.WriteLine("Salve Mundi!");
#endif
Console.ReadKey();
}
When I switch to Release configuration Resharper ignores the else branch of my code.
How can I force Resharper to consider the right compilation symbols?
Environment:
Upvotes: 0
Views: 270
Reputation: 1484
Reloading(unload and reload project in visual studio) the project makes Resharper reconsider the view and will make the right portion of code active.
Upvotes: 0