Build components, plug-ins, syntax generators, and presentation styles are typically built using .NET Standard so that they will work with both MSBuild and dotnet build. This creates an issue when trying to debug the components using the standalone GUI as the host. When the components are built with .NET Standard, Visual Studio will launch the .NET Core debugger for the project which will not be invoked when using the standalone GUI as the host because it uses the .NET Framework. Any breakpoints set within the .NET Standard component are ignored.
The workaround to this issue is to use conditional properties within the project to target the .NET Framework for debug builds and .NET Standard for release builds. By using .NET Framework when debugging, the correct debugger is launched and will be invoked when the standalone GUI starts up. Breakpoints set within the component code will then be triggered when hit as expected.
Configuration UI projects used to edit a component's configuration are an exception as they always use the .NET Framework. If they are used as the startup project, debugging will also work as expected and breakpoints in the component projects will also be triggered whether or not they were built using the .NET Framework.
If you created a component project using version 2022.2.6.0 or earlier of the Visual Studio package, you will need to edit the project properties as shown below so that debugging works as expected. All project templates in the latest release contain the necessary conditional properties.
<!-- See the help topic https://ewsoftware.github.io/SHFB/html/d7b0528c-c75a-477b-9445-db6d2c55dbcb.htm
for information on why conditional target frameworks are used. -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<!-- Use the full framework for debugging -->
<TargetFramework>net47</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<!-- Use .NET Standard for release builds -->
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<!-- Only use an unconditional target framework if you have a UI project within the solution that can be
used to start debugging.
<TargetFramework>netstandard2.0</TargetFramework> -->
.
.
.
</PropertyGroup>