XamlParseException在使用DataGrid构建Release版本时发生

huangapple go评论37阅读模式
英文:

XamlParseException when building in Release with DataGrid

问题

在尝试以发布配置构建Avalonia应用程序时,出现“在使用DataGrid构建发布时出现XamlParseException”错误。在调试模式下工作正常。直接添加Avalonia.Controls.DataGrid NuGet包可以解决问题,但似乎有点奇怪。

英文:

When trying to build Avalonia application in release configuration it crashes with "XamlParseException when building in Release with DataGrid". In debug mode works perfectly

Adding Avalonia.Controls.DataGrid nuget package directly solves problem, but seems a little bit strange

答案1

得分: 1

在进行一些搜索后,我找到了一个解决方案:
在 cproj 文件中,在以下代码之后:

    <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />

只需添加以下行:

    <PackageReference Condition="'$(Configuration)' == 'Release'" Include="Avalonia.Controls.DataGrid" Version="0.10.18" />```

<details>
<summary>英文:</summary>

After some search i found a solution:
In cproj file after:
&lt;!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--&gt;
&lt;PackageReference Condition=&quot;&#39;$(Configuration)&#39; == &#39;Debug&#39;&quot; Include=&quot;Avalonia.Diagnostics&quot; Version=&quot;0.10.18&quot; /&gt;
Just add the line:
  &lt;PackageReference Condition=&quot;&#39;$(Configuration)&#39; == &#39;Release&#39;&quot; Include=&quot;Avalonia.Controls.DataGrid&quot; Version=&quot;0.10.18&quot; /&gt;```

huangapple
  • 本文由 发表于 2023年2月8日 21:47:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386724.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定