Class disappears when switching from "Release" to "Debug"

22 views Asked by At

I'm using Visual Studio 2022 (Version 17.9.2) to write some C# (.Net 8.0) Code. I have a Solution with multiple projects, and most of it works fine. However, I have a class "PreProcessor" in one of the projects, which is only present when I have my build configuration set for "Release". As soon as I switch to "Debug" it just disappears, including visually from the Solution Explorer.

When I use it while it's set to "Release", everything works fine, including all the code I have in "PreProcessor". If I switch to "Debug", I get the error:

Error CS0246 The type or namespace name 'Preprocessor' could not be found (are you missing a using directive or an assembly reference?)

After trying to look up the issue I couldn't really find something. There were some descriptions of similar problems, where they had linked some external libraries that caused he issue, but this is not the case for me. This specific class doesn't even use any of the classes from the other projects in the solution and only interacts with the other classes in the project, which do not have the same problem. Some suggestions even mentioned relative paths might be the issue if I point to anything that is only present in "Release", but this is also not the case.

I am unsure what additional information would even be helpful for this issue. I'm on Windows 11, using Visual Studio 2022, writing .NET 8.0 C# code and it's part of a Github repository, though everything except for the code and config files are ignored for the repository.

The .csproj file looks like this:

<Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
      </PropertyGroup>
    
      <ItemGroup>
        <ProjectReference Include="..\BenchmarkParsing\BenchmarkParsing.csproj" />
      </ItemGroup>

</Project>

The reference is to another project in the solution, though this reference is not used in the affected class.

0

There are 0 answers