This page from Microsoft about trubleshooting XAML Hot reload says this:
By default, source info is included in a Debug configuration. It is controlled by MSBuild properties in your project files (such as *.csproj). For WPF, the property is XamlDebuggingInformation, which must be set to True. For UWP, the property is DisableXbfLineInfo, which must be set to False. For example:
WPF:
<XamlDebuggingInformation>True</XamlDebuggingInformation>
UWP:
<DisableXbfLineInfo>False</DisableXbfLineInfo>
Since my project configuration name isn't "Debug" the hot reload property is not automatically in my MSBuild configuration and as you can see Microsoft recommend that I add XamlDebuggingInformation
to my .csProj in order to get XAML hotreloading to work but I have no idea how todo that.
I tried just adding a new line into the <PropertyGroup>
tag that had the configuration I wanted to apply but then Visual Studio had a very hard time loading after that. How do I add this MSBuild property?
Example of csproj file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1EA7A7EC-D092-4DE3-B8DD-49F74B71ACF2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PatchDeDup</RootNamespace>
<AssemblyName>PatchDeDup</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'OtherDebug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\OtherDebug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
... file includes, dependency references, etc. (pretty generic wpf project stuff)
I assumed that I'd have to add <XamlDebuggingInformation>True</XamlDebuggingInformation>
inside the PropertyGroup
for the OtherDebug|AnyCPU
but VS 2019 doesn't expect that apparently...
CodePudding user response:
My solution ended up being really simple. Open the .csProj
file find the PropertyGroup
which has the configuration name you expect and add <XamlDebuggingInformation>True</XamlDebuggingInformation>
into the body of the XML tag.
For me I had todo this while Visual Studio was closed cause the Solution Reload failed and Visual Studio got stuck in an infinite loop. But adding it before opening was fine :)