Managing Xbox (One, Series X/S) native app builds

It is important to exclude the Suitest instrumentation library from your production build but to keep it in the instrumented build that you are going to upload to Suitest.

To achieve this comfortably it is best to create a dedicated build configuration. In Visual Studio 2017 you can do this in the following way:

  1. Create a new configuration in the Configuration Manager and copy the settings from your "Release" configuration. Change the name of the copied configuration to "Suitest" (or to any other name you like).

  2. Open project properties and on the Build tab select "Suitest" in the Configuration field. Then append ;SUITEST to the contents of Conditional compilation symbols field.

  3. Unload project (right click project name in Solution Explorer and choose Unload Project).

  4. Open your .csproj file in the text editor and locate the Suitest package reference. It should look approximately like this:

    <PackageReference Include="Suitest">
        <Version>1.*.*</Version>
    </PackageReference>
    

    Replace the above with (make sure to always use the latest instrumentation library version):

    <Choose>
        <When Condition=" '$(Configuration)' == 'Suitest' ">
            <ItemGroup>
                <PackageReference Include="Suitest">
                    <Version>1.*.*</Version>
                </PackageReference>
            </ItemGroup>
        </When>
    </Choose>
    
  5. Save and close the .csproj file and reload the project (right click on the project name and select Reload Project).

After you have done this only builds created with the Suitest configuration will contain the instrumentation library. All other builds will be completely clean of the instrumentation code.