10/16/2024 5:09:03 PM

When working on a larger project, you will often have multiple Visual Studio projects, including one "central" API project. You reference the "central" API from the smaller projects. Depending on how you are developing, referencing, and building the project, you may want to reference a DEBUG dll during development and a RELEASE dll for your production deployments. To do so, you can update the .csproj file in your smaller projects with conditional references.

  1. Build the "central" API in DEBUG mode.
  2. In the smaller project, add the DEBUG dll reference to the "central" api.
  3. In Visual Studio Solution Explorer, double click the name of the smaller project.
  4. Update the references using the example below.
<ItemGroup Condition="'$(Configuration)'=='Debug'"> <Reference Include="Central.API"> <HintPath>..\..\..\..\Central-API\bin\debug\net8.0\Central.API.dll</HintPath> </Reference> </ItemGroup> <ItemGroup Condition="'$(Configuration)'=='Release'"> <Reference Include="Central.API"> <HintPath>..\..\..\..\Central-API\bin\Release\net8.0\Central.API.dll</HintPath> </Reference> </ItemGroup>